This is a migrated thread and some comments may be shown as answers.

[Solved] Losing Paging/Sorting when using GridOperationMode.Client

0 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Max
Top achievements
Rank 1
Max asked on 06 Jan 2012, 06:53 PM

Hi all,

I am losing paging/sorting after I open a popup window containing another grid inside it.
I noticed that the problem occurs if I use "GridOperationMode.Client" in the grid. I am just curious why this would affect my main Grid.

Here is a partial content of my code:

CONTROLLER:
----------------------
[GridAction]
public ActionResult SelectAjaxEntityHistory(Guid entityID)
{
    return View("_EntityHistoryPartial", new GridModel(GetEntityHistory(entityID)));
}

public ActionResult _SelectAjaxEntityHistory(Guid entityID)
{
    return PartialView("_EntityHistoryPartial", GetEntityHistory(entityID));
}

VIEW:
---------
...
@(Html.Telerik().Grid(Model)
        .Name("Grid_Main")
        .DataKeys(keys =>
        {
            keys.Add(p => p.ID);
        })
...

@(Html.Telerik().Window()
        .Name("windowObject")
        .Visible(false)
...
        .Content(@<img src="@Url.Content("~/Content/Common/loading.gif")" alt="loading" />)      
)

function openWindow(entityID) {
    var window = $("#windowObject").data("tWindow");

    window.ajaxRequest('@Url.Action("_SelectAjaxEntityHistory", "SccmSite")', { entityID: entityID });
}

PARTIAL VIEW (_EntityHistoryPartial.cshtml):
--------------------------------------------------------------
...
@(Html.Telerik().Grid(Model)
        .Name("Grid2")
        .DataKeys(keys =>
        {
            keys.Add(p => p.EntityHistoryID);
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
                .OperationMode(GridOperationMode.Client);
                .Select("SelectAjaxEntityHistory", "SccmSite"); //this will be used only if "GridOperationMode.Server" is set
        })
... ... ...

If I change it to GridOperationMode.Server then the main Grid paging/sorting works fine.

Why? Thanks

Tags
Grid
Asked by
Max
Top achievements
Rank 1
Share this question
or