I have a test igHierarchicalGrid of two levels, initially it is populated in the view like this:
@(Html.Infragistics().Grid(Model.AsQueryable())....
The grid is working perfectly. I want to simulate an update to this grid so I make a call to GetNewData() action in the controller and return a Json with new data. In the client I rebind to this new data but nothing change in the grid. Look at the sample I have attached.
How to rebind this new json data to the grid?
Hello Luis,
I've modified your project with the following changes:
- changed the model that was passed to the grid
- as a consequence of the above I defined both columns for parent and child layouts
- added "ResponseDataKey" properties for both parent and child grid
- added a separate action in the controller that returns the whole data and pass it as a parameter to DataSourceUrl in the grid configuration
- removed calling of 'dataBind' method after setting the new datasource, because it seems that it re-binds to the old datasource
Attached you can find the project for your reference.
If you have any questions, please let me know.
Regards,
Tsanna
Hi Tsanna, I have to reopen this case because I found that Product rows are not updated when calling new data. The products 'Coca cola' and 'Tofu' should be 'Coca cola NEW' and 'Tofu NEW' after updating but they are not in the grid. How to fix it? Thanks
Hi Luis,
Please change the last two lines of code in 'rebindNewData' function to be as following:
function rebindNewData(data) {
... $("#MyGrid").igHierarchicalGrid('option', 'dataSource', newCategories); $("#MyGrid").igHierarchicalGrid("dataBind"); }
I'm attaching the whole project for your reference.
Thanks a lot Tsanna!! It works beautifuly! You saved me a lot of extra work ;)
Can I help you with anything else?
Well, maybe this new issue
http://es.infragistics.com/community/forums/p/94768/468446.aspx#468446
Thanks ;)
This forum thread that you asked about was handled by my colleague Michael Harrington and he will assist you for it.
If you have any other questions related to the topic in the current forum thread, please let me know.
Sincerely,