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
225
Update the grid data and columns on button click
posted

Hi Team,

I want to update the grid's data and structure on button click.

Scenario is as below:

I have created a hierarchical grid using MVC GridModel class (defined columns and features in controller) and in View, I  have written: @Html.Infragistics().Grid(Model). This works fine.

Now the requirement is like this:

I have a multi select check box list, where there are a list of columns. I need to pass the selected columns (may be as a comma separated list) and re-create the grid with the selected columns.

Issue 1:

I am able to create and bind the igCombo with multiple selection. But when I try to fetch the selected values, I receive errors:

If I use: var selectedItems = $("#possibleColumnsCheckBox").igCombo("selectedItems") and loop through the selectedItems, and try to fetch the value using:
selectedItems[i].value, I get undefined (though it loops the number of items selected).

When I try to use: var selectedItems = $("#possibleColumnsCheckBox").igCombo("values"), I get the error:
no such method 'values' for igCombo widget instance  

How to select the value of this checkbox list.

Issue 2:


On button click, I manually pass the value using a post request, call a action method, create the grid, pass the column list (should be the one selected above, but for now, I manually create it), fetch data for these columns from database, define features and return the ViewResult and try to render the updated grid.

I keep the AutoGenerateColumns to true here and binds the grid with the updated datasource. But, when I debug, I find that the grid has no columns and the updated grid is not rendered on the view.

Not sure, what is the issue here. Could you please help me resolve these two issues.

-Regards,

Agraj