Comments (6)
@tarangsachdev92 by chaning this.data
will not reflect on the grid. You need to assign a new array to this.data
. You can add a row using inbuilt add feature. Right now there is no option to add a row dynamically. I will see if I can add this feature over the weekend.
from angular-tree-grid.
this.data = [
...this.data,
{
id: 16,
name: "Mayur",
age: 20,
weight: 20,
gender: 1,
phone: 7930343463,
parent: 10
}
];
for (const da of this.data) {
if (da.expanded) {
this.ref.detectChanges();
this.expandRow(da.id);
this.ref.detectChanges();
}
}
I am able to push that row in this.data
by above code I am able to add new row dynamically,
may be you got me wrong.my concern is little bit different.
I looped through this.data and if (row) is alredy expanded before, then I want that row expanded after adding.
this.expandRow(da.id); with this code I am expecting the row expand but it expand me all the child row of first row.
from angular-tree-grid.
Okay. I see you are assigning new array to this.data
and that will add new row. So basically what it thinks, it got a new Array so it tries to refresh the grid. I think maybe before updating this.data
, you can track which rows are expanded then after few seconds(setTimeout?) you can try to expand those rows via expandRow
. setTimeout
is not Ideal here but you can try. I will see if I can fire some events when grid is ready to be updated.
from angular-tree-grid.
you can again check provided stackblitz and Screen Recording for better understanding.
with my code I can able to expand row (which I had tracked on click of expand button and collapse button).
// in this code I have add expanded property with boolean value)
onCollapse(e) {
const rowData = e.data;
this.data.map(elem => {
if (elem.id === rowData.id || elem.parent === rowData.id) {
elem.expanded = false;
}
return elem;
});
}
onExpand(e) {
const rowData = e.data;
this.data.map(elem => {
elem.expanded = elem.expanded || elem.id === rowData.id;
return elem;
});
}
and as in previous reply I looped thorugh and identify which row is epanded and I called
this.angularGrid.expandRow(id);
this is working good in some condition but this is not working as expected for the steps which are descirbed in a question.
this code expand the row but it's child also gets expanded(before add it(child) was not expanded).
from angular-tree-grid.
@tarangsachdev92 I have pushed a fix. Try latest version and let me know if this works.
from angular-tree-grid.
ok.that's cool and aworking as expected for my requirement.Thank you 👍
from angular-tree-grid.
Related Issues (20)
- Will the code work in IE HOT 1
- Tree Structure fails for the given data HOT 1
- Need to have a button as column header, Please guide how to implement HOT 3
- how to use header_rendere, can you please give sample code snippet HOT 10
- Problem with expandRow in case of Dynamic Children
- expandAll() collapseAll() Callback
- How to use events? HOT 5
- Misaligned nested items of the same level HOT 1
- Force refresh children datas without loosing expansion states HOT 5
- Help HOT 2
- How to add Routing where when i click on specific item it navigate to other Page HOT 3
- Parent Dropdown is missing on Edit HOT 1
- Cancel icon not work in edit mode HOT 12
- Not working in angular 12 HOT 1
- update the package.json to the latest supported angular version HOT 5
- Doesn't work on angular 12
- expand all/ collapse all functionality does not work on first click until manually rows are expanded- angular 13 HOT 5
- with what angular version did you compile the new release (4.0.6) with ? HOT 10
- Is there a version on this that works with AngularJS? HOT 1
- keyboard navigation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-tree-grid.