I'm trying to use the IgniteUI Grid control with MVC. The data appears in the Grid properly when viewing, but when I call my Edit ActionResult method in my controller to save the view back to the model, the property that is bound to the Grid comes back as being null while all other fields have their correct values. The Grid only renders a single property of the model, not the entire thing. I cannot figure out what I need to do in order to get the Grid to push its data into the view and back to the model when saving.
I have attached a stripped down example of what I am trying to do. The real code has a lot more properties, all of which get their correct values except for the Grid.
Any suggestions as to how I can the Grid data to be sent back with everything else? Do I need to call something in order for the Grid to save its data so that it's sent back with the rest of the view data?
Thanks.
Hello Keith,
Thank you for posting in our community.
I believe that the following article from our documentation regarding Updating overview will help you achieve better understanding how igGrid Updating feature works.
http://www.igniteui.com/help/iggrid-updating
Basically, igGrid communicates with igGrid MVC Helper wrapper to persist changes on the server. This feature uses transactions to log changes made to the grid. These transactions are kept locally in the browser until the igGrid.saveChanges API method is called to send a POST request to the Url indicated by the grid.updateUrl option. On the server these transaction should be parsed and processed and the igGrid MVC helper wrapper greatly simplifies this task. A working sample illustrating how basic editing works could be found at the following link:
http://www.igniteui.com/grid/basic-editing
I hope you find my information helpful.
Please let me know if you need any further assistance with this matter.
From the looks of the article and what you're saying then, it seems that the only way to update the data in the Grid is to use specify a controller action using UpdateUrl; there is no way to simply pass the Grid's data back with the rest of the view's data? Is that correct? That would seem like a fairly major limitation, especially for the project I'm working on. My rows need to be associated a parent record - this becomes problematic when creating a new parent record as the Grid will not yet know the ID of the parent record and the UpdateUrl method runs independently of the controller's Create action. Not including the Grid on the create page is not an option. So if the Grid requires UpdateUrl and cannot pass it back with the rest of the view's data, it would seem that I might be stuck.
In short, it looks like the Grid reads from the model, but it cannot write back to the model and can only persist back to the database.
Thank you for your clarifications.
I will investigate your requirement further and I will get back to you as soon as I have any new information regarding this matter.
Please feel free to continue sending updates to this case at any time.
Sorry, I realized that I should probably mention that I'm working with version 2014.2 as that might have an impact.