Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote data contains column names... #51

Closed
CobraFlow opened this issue Jun 3, 2015 · 11 comments
Closed

Remote data contains column names... #51

CobraFlow opened this issue Jun 3, 2015 · 11 comments

Comments

@CobraFlow
Copy link

I have a static tree grid working fine but would now like two features :

  1. Dynamic col_defs.
    The idea here is that the data is retrieved from an external source via a promise. Once the promise is complete, I have both the col_defs and the tree_data. Is there any way to 'refresh' or 'reload' the tables from the new definition?

  2. Different col_defs per branch.
    I have a requirement to have different col_defs per branch. Is this possible?

Kind regards

@jirihelmich
Copy link

+1 for dynamic col_defs, I assumed it works like that and now I'm wondering how to use the directive.

@jirihelmich
Copy link

Sorry, after diving into the source code, I found a way, I just need to keep using the same array, since the reference to it is set just during compile and is not updated later.

So, to use it dynamically:

$scope.colDefs = [];

allMightyApi.loadData(function(data){
...
   updateColDefs(data);
...
});

function updateColDefs(data){
   $scope.colDefs.length = 0; // you can't do $scope.colDefs = []; it will not update
   data.columns.forEach(function(c){
       $scope.colDefs.push(transform(c));
    });
}

function transform(c){
    // anything you need to do
}

@holimL
Copy link

holimL commented Jun 29, 2015

This helped me a great deal, thanks!!

@Hesesses
Copy link

Wow, thanks @jirihelmich!

@TrueDub
Copy link
Collaborator

TrueDub commented May 31, 2016

I've added a link to this issue to the readme, to share the knowledge. Closing the issue.

@TrueDub TrueDub closed this as completed May 31, 2016
@zatchgordon
Copy link

So OP asked 2 questions and only the first question was answered. I'm also wondering about question number 2. Is there anyway to have different col_defs per each branch?
Example:
The first row has columns : lastName, firstName, Email
but then the second row has : firstName, lastName, phoneNumber, jobTitle
(and then the third column has completely different col_defs)

Is that possible with the current code? Is it ever going to be possible with this directive?

@ghost
Copy link

ghost commented Nov 7, 2016

how use drag and drop item? thanks

@rezanadimi72
Copy link

HI
i want to hide first column that automatic create!!!
is it possible???

@zatchgordon
Copy link

@rezanadimi72 It looks like the only possibility (without changing code yourself) is to change what icons are shown

<tree-grid
    icon-leaf     = "icon-file"
    icon-expand   = "icon-plus-sign"
    icon-collapse = "icon-minus-sign">
</tree-grid>

hypothetically you could make them invisible by giving them a class that doesn't exist.

Alternatively, assuming your tree-grid has the class of "tree-grid" you can use the following css

        .tree-grid tr th:first-child {
            display: none;
        }

        .tree-grid tr td:first-child {
            display: none;
        }

Finally, I don't think there is a point to doing this. The first column is what offsets "children" rows which is the whole reason for using this directive. Getting rid of the first column would make this directive act like a regular table. It seems like you might actually want a grid directive such as ui-grid.

@ANaveenA
Copy link

ANaveenA commented May 29, 2018

Do you have anything like this for Angular 5 table bootstrap tree.will it supports angular5

@ghost
Copy link

ghost commented May 29, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants