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
405
Communication between IGgrids and IGgrid elements
posted

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. 

RebindProviderCorrect.zip
Parents
No Data
Reply
  • 18204
    Offline posted

    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.

    RebindProvider_Modified.zip
Children