I use WebHierarchicalDataGrid with two levels.
I need to implement following scenario:
1. The grid's initially populated only with first-level rows. (the rows have no child rows)
2. User does some action (for ex. clicks on a button) and a child row is added to the selected parent row.
I've done it in following way:
var selectedRow = getSelectedRow(); var childGrid = selectedRow.get_rowIslands()[0]; var row = new Array(""); childGrid.get_rows().add(row);
This approach works fine if parent row already has at least one child row, but if there is no child rows I get null reference exception: selectedRow.get_rowIslands() returns empty array.
Please help!
Hi Alexander,
The child grid has to actually exist on the client for this to work. If you have the RowAdding behavior turned on in the child, then an empty grid will be made.
regards,David Young
Hi, David!
RowAdding behaviour is off, because
1. I add new rows using my own button (not inline functionality) and I don't want this additional line (that allows to add new rows) will be shown.
2. I don't want that empty child grid will be shown for the user (it looks not good)
Is it possible to workaround theese problems?
Alexander
Hi,
I am not sure what is wrong with your behavior. Perhaps you should implement IInheritableBehavior, too. As for the child grids, that is expected. It is what this interface does. What you could do is go through the parent rows and collapse children that have 0 rows and hide the expansion indicator.
-David
How can I hide expansion indicator? Is there a corresponding method>
No there is no method that does this. You would need to actually set display none (or a css that has display none) to the image of the expansion column. row.get_element().childNodes[0] is the expansion cell without grouping.
Thank you, David!
I will try the suggested approach, and probably will prepare small sample that demonstrates my problem with custom behaviour.
Alexander.
Hello Alexander,
Inform me if you need additional assistance with this question.