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

Grid Ajax binding pagination

2 Answers 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jagdish
Top achievements
Rank 1
Jagdish asked on 23 Apr 2013, 04:50 PM
I am using the grid to show search results in a form. On submit I generate the search results and show in the grid. Currently the pagination doesn't work .

In the documentation it is mentioned that I have to create a read method like
public ActionResult Products_Read([DataSourceRequest]DataSourceRequest request)
{
var products = new NorthwindDataContext().Products;
DataSourceResult result = products.ToDataSourceResult(request);
return Json(result);
}


 It would be hard for me to generate the search list in Ajax read method. How can I use the previously generated list for ajax Read method ? 


@(Html.Kendo().Grid(Model.DocumentSearchList).Name("Grid")
              .Sortable()
              .Filterable()
              .Pageable()
              .Selectable(selectable => selectable.Mode(Model.Workflow == null ?
                       GridSelectionMode.Single :
                       (Model.Workflow.SelectionMode == SelectionMode.Single ? GridSelectionMode.Single : GridSelectionMode.Multiple)))
                      .Columns(col =>
                                   {
                                       col.Bound(model => model.DocumentTypeName).Title("Type");
                                       col.Bound(model => model.DocumentSubtypeName).Title("SubType");
                                       col.Bound(model => model.DocumentStatusName).Title("Status");
                                       col.Bound(model => model.ShortTitle).Title("Doc Title");
                                       col.Bound(model => model.JurisdictionName).Title("Jurisdiction");
                                       col.Bound(model => model.TopicsCount).Title("Topics");
                                       col.Bound(model => model.WorkOrdersCount).Title("Work Orders");
                                       col.Bound(model => model.WOSubmittedUserFullName).Title("Submitted By");
                                       col.Bound(model => model.WorkOrderSubmittedDate).Title("On").Format("{0:MM/dd/yyyy}");
                                       col.Bound(model => model.CreatedUserFullName).Title("Created By");
                                       col.Bound(model => model.CreatedDate).Title("On").Format("{0:MM/dd/yyyy}");
                                       col.Bound(model => model.UpdatedUserFullName).Title("Updated By");
                                       col.Bound(model => model.LastUpdatedDate).Title("On").Format("{0:MM/dd/yyyy}");
                                   })
                      .DataSource(dataSource => dataSource.Ajax()
                                                    .Model(model => model.Id(p => p.DocumentId))
                      )
                      .Events(e => e.Change("selection_change")))

2 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 24 Apr 2013, 11:38 AM
Hi Jagdish,


In the current scenario you could specify the ServerOperation(false) which will force the Grid to perform all operations on the client side (including the paging).

E.g.
.DataSource(dataSource => dataSource
    .Ajax()
    .ServerOperation(false)
)

Please let me know if this was the information that you were looking for.

 

Regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jagdish
Top achievements
Rank 1
answered on 26 Apr 2013, 07:17 PM
Thanks !
Tags
Grid
Asked by
Jagdish
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Jagdish
Top achievements
Rank 1
Share this question
or