Hi,
I wonder to know if there is any possibility to save the last grid actions (filters, grouping, sorting...) ? When users do some filtering and quite the page, I'd like them to find the grid as they left before. Is it possible to use any session or cookies with grid?
Hello Cem,
What the Ignite UI MVC Helpers do is to render the control configuration as JavaScript code, so it doesn't make sense to store the grid state on the server, because at the end the feature state should be on the client in some form to be restored in JavaScript.
I used the sample that I sent you before and applied it to an MVC solution. You can find it attached.
Best regards,Martin PavlovInfragistics, Inc.
Hi Martin,
Thank you for your reply and your exemple. Sorry about not being as clear. I'll give you some more information about my case. I'm using an iggrid as you mentioned but with MVC Helper. So I cant really implement your example it is also remote sorting, paging etc.
My grid:
@(Html.Infragistics()
.Grid<ProductModel>()
.ID("pcd-grid")
.AutoGenerateColumns(false)
.RenderCheckboxes(true)
.PrimaryKey("ProductID")
.EnableUTCDates(false)
.Columns(column =>
{
column.For(x => x.ProductId).Column.Hidden = true;
column.For(x => x.ProdName).HeaderText("Product name").Width("20%").DataType("string");
...
}
.Features(features =>
features.Sorting().Type(OpType.Remote).Persist(true);
features.Paging().Type(OpType.Remote).PageSize(10).Persist(true);
features.Filtering().Type(OpType.Remote).Persist(true);
features.GroupBy().Type(OpType.Remote).Persist(true).GroupByDialogContainment("window");
features.Resizing();
features.Hiding();
})
.DataSourceUrl(Url.Action("GetProducts", "Product"))
.Render())
So won't you have any example with MVC project and controller where we store the grid state and each time user REFRESH the page, he find the last state of grid.
Thank you
I assume that you're talking about igGrid, since igGrid has an ASP.NET MVC Wrapper.
I'm attaching a sample demonstrating how to save the igGrid state in localStorage. When you open it change the grid state by filtering/sorting or paging, then reload the page to see that the state is preserved.
Please note that the sample is in JavaScript, but you can easily use MVC chaining to initialize the grid.
Hope this helps,Martin PavlovInfragistics, Inc.