Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
530
How to Expand/ Collapse when no child rows are present?
posted

Hi folks,

I am wondering how to show expand/collapse when there are no child rows. The reason is, I want to show an empty child row if there are no child rows. Any suggestions are welcome.

I am databinding my hierarchical grid manually to a generic list (eg: a list of categories, each of which can contain a list of products). Also, I am not sure how to add a new row (to the bottom of the grid)  in the parent when the user clicks a button on the page.

Thanks for any help!

Marshal

Parents
  • 33839
    Suggested Answer
    posted

    Hey Marshal,

    We should be able to come up with some solutions for your problems.  If you have a child band defined and the row adding behavior is on in it, the child grid should always appear even if there are no rows of data.  Although there is a bug right now if you do that with load on demand.  Another option is for you to manual load on demand.  If you set the IsEmptyParent property of a row, it will have an expansion indicator.  Then you can handle row islands populating.  Cancel the event and then add a ContainerGrid that you make to the row's RowIslands collection.

    As for your second question, if you use the row adding behavior, it will add the row to your datasource for you if you use AutoCRUD.  If you don't want the add row, just turn on editing core and do the following.

    var grid = $find("WHDG1");

    grid.get_gridView().get_rows().add(newVals);  where newVals is an array of values for the new row.  You could do that on your button click.  Let us know if you need more help.

    regards,
    David Young

Reply Children