This question is locked. New answers and comments are not allowed.
I have an MVC 3 Razor solution where I have a View that provides the user with the option to choose what columns to view in a Grid.
When the user selects the columns (checkboxes tied back to an OptionsViewModel) they can update the Grid, which fires a jQuery Ajax call to update a panel with a Partial View that contains the Grid.
The Partial includes a model (ListViewModel) that has an IEnumerable<Items> and an instance of the OptionsViewModel within it. I set up the Grid, using the IEnumerable<Items> as the model and then bind columns using syntax like:
cols.Bound(c => c.Description).Visible(Model.Options.DisplayDescription).Column.Title = "Desc.";
This all works fine. The grid loads and displays the columns as per the user's display selections. Great.
I am now stuck when I want to add Sorting / Paging / Filtering as I believe I need to utilize a GridAction and use the GridModel. Doing this means that my partial won't like the model (expects a ListViewModel, not a GridModel<Items>), and I have no idea how to retain the user's selected columns as I can't pass the OptionsViewModel back in to the GridAction.
Any ideas on how to best get this scenario up and running? I am happy to change my approach all together as long as I can get dynamic/user defined columns, sorting, paging, and filtering all working together in harmony.
Thanks,
Matt
When the user selects the columns (checkboxes tied back to an OptionsViewModel) they can update the Grid, which fires a jQuery Ajax call to update a panel with a Partial View that contains the Grid.
The Partial includes a model (ListViewModel) that has an IEnumerable<Items> and an instance of the OptionsViewModel within it. I set up the Grid, using the IEnumerable<Items> as the model and then bind columns using syntax like:
cols.Bound(c => c.Description).Visible(Model.Options.DisplayDescription).Column.Title = "Desc.";
This all works fine. The grid loads and displays the columns as per the user's display selections. Great.
I am now stuck when I want to add Sorting / Paging / Filtering as I believe I need to utilize a GridAction and use the GridModel. Doing this means that my partial won't like the model (expects a ListViewModel, not a GridModel<Items>), and I have no idea how to retain the user's selected columns as I can't pass the OptionsViewModel back in to the GridAction.
Any ideas on how to best get this scenario up and running? I am happy to change my approach all together as long as I can get dynamic/user defined columns, sorting, paging, and filtering all working together in harmony.
Thanks,
Matt