This question is locked. New answers and comments are not allowed.
I have been looking forward to the OperationMode as I would love to have a way to persist grouping state, etc.
I have two questions...
#1 - I am working server side for the initial binding and we have checkboxes. This includes client and server templates. I have been looking for a way to capture the state of the grid when calling the controller via Ajax? How can I do that?
#2 - If I go all server side, how can I capture the state of the grid so I can persist via my own session the sorting, page, grouping, etc? easily and then assign them?
#3 - In order to use OperationMode, do I have to be all Ajax? Or can I mix the server binding and then Ajax (this does not work in my testing so far)
Below is my grid definition...
<%
int[] checkedRecords = (int[])ViewData["checkedRecords"];
Html.Telerik().Grid(Model.AdminSongQueue)
.Name("AdminViewQueueGrid")
.DataBinding(
dataBinding => dataBinding.Ajax()
.OperationMode(GridOperationMode.Client)
.Select("_Index", "Admin")
)
.DataKeys(k => k.Add(o => o.ProviderTrackId))
.Columns(columns =>
{
columns.Template(o =>
{
%>
<input name="adminFormViewModel.SelectedRecords" id="adminFormViewModel_SelectedRecords" type="checkbox" value="<%= o.ProviderTrackId %>" />
<%
}).Title(strings.ID_25).Width(25).HtmlAttributes(new { style = "text-align:center" })
.ClientTemplate("<input type='checkbox' name='adminFormViewModel.SelectedRecords' id='adminFormViewModel_SelectedRecords' value='<#= ProviderTrackId #>' />")
.Title(strings.ID_25)
.Width(25);
columns.Bound(o => o.ProviderTrackId).Title(strings.ID_18).Width(30).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.track_title).Title(strings.ID_19).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.album_performers).Title(strings.ID_8).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.album_title).Title(strings.ID_42).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.full_name).Title(strings.ID_20).Width(150).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.workflow_status_descr).Width(50).Width(25).Title(strings.ID_22).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.deadline_date).Width(90).Format("{0:MM/dd/yyyy}").Title(strings.ID_28).HtmlAttributes(new { style = "font-weight:normal" });
})
.Sortable()
.Groupable()
.Filterable()
.Resizable(resizing => resizing.Columns(true))
.ClientEvents(events => events
.OnRowSelect("GreenLight.AdminIndex.onRowSelect_AdminViewQueueGrid"))
.Pageable(pager => pager.PageSize((int)ViewData["DisplayRecordCount"]).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPrevious)
.Position(GridPagerPosition.Both))
.Selectable()
.Render();
%>
I have two questions...
#1 - I am working server side for the initial binding and we have checkboxes. This includes client and server templates. I have been looking for a way to capture the state of the grid when calling the controller via Ajax? How can I do that?
#2 - If I go all server side, how can I capture the state of the grid so I can persist via my own session the sorting, page, grouping, etc? easily and then assign them?
#3 - In order to use OperationMode, do I have to be all Ajax? Or can I mix the server binding and then Ajax (this does not work in my testing so far)
Below is my grid definition...
<%
int[] checkedRecords = (int[])ViewData["checkedRecords"];
Html.Telerik().Grid(Model.AdminSongQueue)
.Name("AdminViewQueueGrid")
.DataBinding(
dataBinding => dataBinding.Ajax()
.OperationMode(GridOperationMode.Client)
.Select("_Index", "Admin")
)
.DataKeys(k => k.Add(o => o.ProviderTrackId))
.Columns(columns =>
{
columns.Template(o =>
{
%>
<input name="adminFormViewModel.SelectedRecords" id="adminFormViewModel_SelectedRecords" type="checkbox" value="<%= o.ProviderTrackId %>" />
<%
}).Title(strings.ID_25).Width(25).HtmlAttributes(new { style = "text-align:center" })
.ClientTemplate("<input type='checkbox' name='adminFormViewModel.SelectedRecords' id='adminFormViewModel_SelectedRecords' value='<#= ProviderTrackId #>' />")
.Title(strings.ID_25)
.Width(25);
columns.Bound(o => o.ProviderTrackId).Title(strings.ID_18).Width(30).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.track_title).Title(strings.ID_19).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.album_performers).Title(strings.ID_8).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.album_title).Title(strings.ID_42).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.full_name).Title(strings.ID_20).Width(150).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.workflow_status_descr).Width(50).Width(25).Title(strings.ID_22).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.deadline_date).Width(90).Format("{0:MM/dd/yyyy}").Title(strings.ID_28).HtmlAttributes(new { style = "font-weight:normal" });
})
.Sortable()
.Groupable()
.Filterable()
.Resizable(resizing => resizing.Columns(true))
.ClientEvents(events => events
.OnRowSelect("GreenLight.AdminIndex.onRowSelect_AdminViewQueueGrid"))
.Pageable(pager => pager.PageSize((int)ViewData["DisplayRecordCount"]).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPrevious)
.Position(GridPagerPosition.Both))
.Selectable()
.Render();
%>