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
110
Binding igHierarchicalGrid after initial binding not working.
posted

Hi,

I'm trying to use a search component to populate the hierarchical grid with json data. The issue I'm running into is that the grid is initialized on screen load and the datasource is set to a json object that is empty i.e "var datasource = [];" When I then get data via an ajax call and try to update the datasource object with the data returned from the ajax call and rebind my grid "$("#myHierarchicalGrid").igHierarchicalGrid("dataBind");" nothing happens.

Is there a way to initialize the hierarchical grid initially to an empty json object and rebind it with a json object at a later point in time? I also tried to do something like the following code snippet, but because the grid's initial datasource was empty it doesn't return any child table elements for me to bind to.

$('#hierarchicalGrid').igHierarchicalGrid('allChildrenWidgets')[0].dataSourceObject(jsonObject);

Any help would be greatly appreciated!!!

Parents
  • 4315
    Offline posted

    Hi, Chris.

    Thank for using our product and contributing in our community.

    You can change the data source after grid is initialized, using the dataSource option of the grid. Once you change it at runtime, you don't need to rebind, the grid does this internally. Please try the following code and tell me if it fits your case ("adventureWorks" is JSON data source).

    $("#grid1").igGrid({   

           dataSource: [],   

           features: [    {     name: "Paging",     type: "local",     pageSize: 13    }   ]  

    });    

    $("#grid1").igGrid("option", "dataSource", adventureWorks);

    For any further questions, please don't hesitate to ask me.

    Best regards,
    Nikolay Alipiev

Reply Children