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

Conditionally display expand/collapse icon #24

Closed
rrajesh011 opened this issue Jan 28, 2020 · 8 comments
Closed

Conditionally display expand/collapse icon #24

rrajesh011 opened this issue Jan 28, 2020 · 8 comments

Comments

@rrajesh011
Copy link

rrajesh011 commented Jan 28, 2020

Hi @debabratapatra
First of thanks for this module it helps a lot to me.

I want to display expand icon when it has child.
I have a property in data object hasChild:true.

When I add loading_children_on_expand to true it display expand and collapse icon on all rows. Any way to add those icon conditionally.

Here is my config

configs: any = { id_field: 'id', parent_id_field: 'parent', parent_display_field: 'name', loading_children_on_expand:true, css: { // Optional expand_class: 'fa fa-caret-right', collapse_class: 'fa fa-caret-down', }, columns: [ { name: 'name', header: 'Name', width: '100px' }, { name: 'age', header: 'Age', renderer: function(value) { return value + ' years'; } }, { name: 'weight', header: 'Weight' }, { name: 'gender', header: 'Gender', renderer: function(value) { return value ? 'Male' : 'Female'; } }, { name: 'phone', header: 'Phone', width: '150px' } ] };

data

data: any[] = [ { id: 1, name: 'Prakash', age: 60, weight: 60, gender: 1, phone: 7930343463,hasChild:false}, { id: 2, name: 'Aditya', age: 40, weight: 90, gender: 1, phone: 7930343463, hasChild:true} ];

@rrajesh011 rrajesh011 changed the title Conditionally display expand icon Conditionally display expand/collapse icon Jan 28, 2020
@debabratapatra
Copy link
Owner

@rrajesh011 thanks for using this component. You can try disableRowExpand function. It should work.

@rrajesh011
Copy link
Author

rrajesh011 commented Jan 29, 2020

@debabratapatra I'm confused where to add this function, can you please explain me with an example. It will be help for me and other also. One more thing any way to apply bootstrap styling like table-dark, table-hover etc

@debabratapatra
Copy link
Owner

debabratapatra commented Feb 6, 2020

@rrajesh011 try adding leaf_node=true instead of hasChild:false. Use the latest version. Here is an example. You can always override existing css. Sorry for the delayed response.

@rrajesh011
Copy link
Author

@debabratapatra thanks for reply.
One more thing, is this possible to expand one row at a time. I mean if i expand a row already expanded row will collapse and vice versa.

@debabratapatra
Copy link
Owner

debabratapatra commented Feb 20, 2020

I think this is what is happening here. If you click on expand icon(mean row is already expanded), it will collapse. Can you elaborate your problem?

@rrajesh011
Copy link
Author

https://angular-tree-grid.stackblitz.io/basic_tree_grid here when i click on Bimal's expand icon if Sunil's row is expanded i want it to be collapsed automatically.

https://codepen.io/johnfinkdesign/full/xEVqvP check this out.

@debabratapatra
Copy link
Owner

I guess for this case collapseAll() (Maybe on expand event) should help. And it needs to be used smartly overcome this.

@rrajesh011
Copy link
Author

@debabratapatra thanks for reply.

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

2 participants