The Problem we are facing:Whenever we change something inside an IGgrid, we have to reload the whole website to communicate the changed state to all other IGgrids relating to that IGgrid we just changed.
We want to create a way to communicate data changes from one IGgrid to the other in the .cshtml and C# (MVC) context of the View. More specifically: IGgrid A adds/deletes/changes one of its rows. And it so happens, that a second IGgrid B uses these rows as a selection in a dropdown combobox when creating a new row in IGgrid B. How can IGgrid A inform IGgrid B's combobox, to update its unrelated combobox values to represent the new state of IGgrid A without reloading the website?
What we found so far:We found a way to change data and rebind the data specifically via JavaScript only and via an external function (as attached to this post).Now here are the problems with that:
1. They use JavaScript entirely but we are reyling on the C# (MVC) context to create our IGgrids in the View. How can we create the same effect as seen in the example within the C# context of the View?2. They use an old version of IGgrid and the infragicstics API and it doesn't seem to work in newer versions (2015 onwards). We are using a newer version from 2015.3. The data type used to represent the dropdown combobox values is a simple array of numbers. How can we do this with a more complex data type like a C# (MVC) list or C# (MVC) dictionary?
What we got:We use the Entity Framework as well, to manage data in the backend on the server side. But this problem mostly concerns the client side. On the client side, we use dataSource(ViewBag.data) for a combobox to get data from the controller. This works fine until changes occur without reloading the site, so this seems to be a no-go. What we need:A way to accomplish said problem with the IGgrid of the 2015 infragistics API.
Hello Stanislas Mauser,
Thank you for posting in our forums!
I have a question to help get a better understanding of your scenario:
1. Does your backend need to know about the changes in igGrid A (to continue from your example) at all? Or are any changes to igGrid A only required on client side to be used in igGrid B?
If the backend does not need to know about the changes, binding to the combo editor through javascript (as in the sample you attached) will be fine, and you would not be required to go back to the server.
If the backend does need to know about the changes, you could create an action in your controller to accept the changes and send a request with an AJAX call. Then, you can send the updated datasource back to the client and, in the AJAX success callback, bind to the igCombo as you would in the other method.
You can find more information on using jQuery's AJAX method here:
http://api.jquery.com/jquery.ajax/* Please note this site is not owned or maintained by Infragistics.
For the sample you provided, there have been some changes to the igCombo in 15.1 which is why the sample doesn't work with 15.1. I have modified the sample to work with 15.1 for demonstration that the basic concept will still work as it did in 12.1.
If you need further assistance with this, please let me know and I will be glad to help.
Hello Michael H.,Thanks for your quick reply.
We still got one problem left to solve. The example we showed you so far, did all this in the JavaScript context only. But what we need, is the same functionality using the igGrid defined with C# as seen in the attached screenshot_document.png.
The problem is, that the function of the button in the previous example uses the following way of fetching the combo box dropdown menu:var editor = $("#grid1").igGridUpdating("editorForKey", "ProductID");and applies the new information to said combo box dropdown menu.
When we use it in our code, no matter which key we use in the igGridUpdating() method, we don't seem to be able to fetch the combo box dropdown menu:var editor = $("#iggrid_meeting_documents").igGridUpdating("editorForKey", "RelationName");var editor = $("#iggrid_meeting_documents").igGridUpdating("editorForKey", "DocumentID");var editor = $("#iggrid_meeting_documents").igGridUpdating("editorForKey", "ID");
the var editor is always null when using the previous examples.
If we could fetch the correct combo box dropdown menu, add the new data and apply databind to it as in the previous example you showed us, that would fix our problem entirely.
Note: Our problem would also be solved, if we had a DataSourceUrl() method in the ComboEditorOptions. But it seems there is only a DataSource() method available.