Top of the evening to you!!
I'm currently evaluating the hierarchical grid and I'm stuck trying to implement a simple data source refresh.
I'm using json as data source for the grid. I then have handlers for events like adding a row and updating a row, etc. That works fine. I'm not using/interested in the transactional operations.
What I have to implement is regular updating of the grid data. I get new json every 30 seconds but when I try to use dataSourceObject option of the grid nothing happens. If I call dataBind after setting new data source I get exceptions (i.e. "length is null or undefined"). (I only get this exception when one of the grid records is in expanded state).
Is there an example of how to achieve refreshing of the grid data source after the grid has been initialised? WIll I have to put in logic to expand/reselect the records to hide the refreshing from the user?
Any help is super greatly appreciated:)
Kyryll
Hello casper01,
Thank you for posting in the Infragistics community. I’ve been looking at your question and I put together a simple test to see if any error comes up. I’ve used our demos distributed along with the installation of jQuery product found in my C drive (C:\Program Files (x86)\Infragistics\NetAdvantage 2011.2\jQuery\demos\igHierarchicalGrid) LoadOnDemand sample. In the sample is demonstrated binding the grid to local as well to remote data source. I’ve just extended it with one button in order to refresh the data like this:
I confirm that after pressing the button to refresh the grids the grids are collapsed and then re-rendered without any issues.
In your case if you simply call $("#gridLoadOnDemand").igHierarchicalGrid("dataBind");, does it help?
If you still have any issues can you package a running sample and attach please in order to be able to investigate it further.
Hello Rado:
I am looking for igHierarchicalGrid refresh function and I found this post.
I am using knockout observableArray to bind to igHierarchicalGrid datasource.
When the Json data in my observableArray has been changed, i tried to call:
$("#my_table").igHierarchicalGrid("dataBind");
But the my UI didn't get refresh. The table still showing the old data.
Anything that i missed out?
I am using IgniteUI.Free -Version 13.1.20131.2292.
Appreciate for your reply.
KM
OKay i am able to make it working by assign the same data source file again:
$("#my_table").igHierarchicalGrid('option', 'dataSource', <myknockoutarray>); $("#my_table").igHierarchicalGrid("dataBind");
Not sure if there is any other better solution?
Thanks,
Hello KOK MANG TANG ,
If you’re using KnockoutJS then I recommend that you also take advantage of our knockout js extensions , which support KnockoutJS bindings with the igHierarchicalGrid widget.
You can refer to the following sample from our samples browser, which demonstrates the configuration for achieving two-way data-binding between your model and the grid:
http://www.igniteui.com/hierarchical-grid/bind-hgrid-with-ko
Note that if anything in the model changes then the grid will automatically reflect the changes.
Let me know if you have any questions.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support