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
2515
Refreshing a child datasource
posted

I have a child grid of an igHierarchicalGrid where the datasource is set in event iggridchildcreating. I need to be able to refresh (i.e. change the child to a different datasource) just this child grid without affecting any other child grid. Is there a way to do that after the associated parent row has already expanded and the child grid has been populated? I tried using the "dataBind" against the child grid after changing the datasource , but this did not work.

Parents
No Data
Reply
  • 17590
    Verified Answer
    Offline posted

    Hello,

    In case that you would like to change the data for any particular child level and keep the columns collection the same my suggestion is to get the corresponding child grid by its id and set the new data source via the dataSource option. Since every child grid is an instance of igGrid changing the data source should help you achieve your requirement. For example:

    $("#changeDS").click(function(){
       $("#hierarchicalGrid_0_Products_child").igGrid("option", "dataSource", products )
      });

    I am attaching a small sample illustrating my suggestion for your reference.

    In case that you would like to change columns structure, not just the underlying data you will have to destroy the igHierarchicalGrid and recreate it again with the new columns structure.

    igHierarachicalGridChangeChildDataSource.zip
Children