How to check child rows in treegrid


#1

I checked $items among properties.

But there is a serious error.

Even if the child row is deleted through a function, $items does not change.

I want to check the existence of child row.


#2

It was solved in the following way. Do you have any better way?

var temp =Treegrid.data.getItems(“parent_id”);

if(temp.getLength() ==0){
console.log(“is false”);
}else{
console.log(“is true”);
}


I have created two tree grids.
Grid A is empty.
Grid B has many rows. There is.

Move the rows from grid B to grid A.

Then I used the code below. treegridA.data.serialize(“json”);
The result is zero length.

Objects in grid A can see data normally.
Why doesn’t serialize work properly?


#3

Thank you for your report.
The problem is confirmed. We’ll tr to fix it in one of the future updates.
As a workaround you may reset the child state manually with the:

    const parent = treeGrid.data.getParent(row_id)
    treeGrid.data.remove(row_id);
    }
    if (treeGrid.data.getItems(parent).length == 0) {
        treeGrid.data.getItem(parent).$items = false
        treeGrid.paint()
    }