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

Read data from Model and disable server side paging, sorting, filtering, grouping and instead do it on client side

5 Answers 824 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 01 Jul 2013, 07:13 PM
Hello,
I would like the Kendo grid to use the Model (local data) to initialize the data part and after that I want the grid to do the paging and sorting on the client side only and not go to server at all.

Based on other examples by Kendo I used datasource with the Ajax() call with and ServerOperation set to “false” with no Read(). What happens is interesting grid goes blank and before doing that grid appears to call [HttpGet] method on the controller as if it is a fresh page request. I was assuming that it will not go back to the server again because of ServerOperation(false) condition.

Here is my grid call. Please tell me what I am doing wrong.

Thanks for your help.

Please note: If I disable the datasource line by commenting out, grid displays collected data but paging or sorting won't work as expected as I have not implemented on the server side. 
 
                            @(Html.Kendo().Grid(Model)
                            .Name("Grid")
                            .Columns(columns =>
                            {
                                columns.Bound(model => model.Status);
                                columns.Bound(model => model.Created);
                                columns.Bound(model => model.Name);
                                columns.Bound(model => model.ID);
                                columns.Bound(model => model.ViewImage);
                            })
                            .Pageable()
                            .Sortable()
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .PageSize(3)
                                .ServerOperation(false)
                                )
                        )
 

 

5 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 03 Jul 2013, 02:20 PM
Hi Daniel,


Basically current setup looks valid and should achieve the desired behavior of having client-side only paging / sorting. For convenience I created small example using the same approach and attached it to the current thread - could you please check it and let me know how it differs from your real setup?

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 03 Jul 2013, 07:20 PM
Excellent! Problem was on my side as expected. I had forgotten to add java script file kendo.aspnetmvc.min.js in my layout file.

I am sure it is going to be helpful for lot of other users too.

Thanks for taking time and creating this example and it really helped.



0
Rosi Reddy
Top achievements
Rank 1
answered on 24 Jul 2014, 10:32 PM
I am using this feature as in this example. But I am reading data using ajax read operation.
I am always seeing no data in the grid.
If I set ServerOperation to true, then it works as expected.

Appreciate your inputs on this issue.

.Read(read => read.Action("GetEmployees", "EmployeeController").Data("GetSelectedGroupId"))
.ServerOperation(false) //// paging, sorting, filtering and grouping will be applied client-side
0
Vladimir Iliev
Telerik team
answered on 28 Jul 2014, 08:26 AM
Hi Rosi,

From the provided information it's not clear for us what is the exact reason for this behavior - could you please open a new support thread / forum post and provide runable example where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jobi
Top achievements
Rank 1
answered on 21 Feb 2017, 01:44 PM

Try this  one , let me know if it fixed .

 

.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(false)
.Batch(true)
.Model(model =>
{
model.Id(c=> c.GetSelectedGroupId); // Specify the property which is the unique identifier of the model
})
.Read(read => read.Action("GetEmployees", "EmployeeController"))

Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Daniel
Top achievements
Rank 1
Rosi Reddy
Top achievements
Rank 1
Jobi
Top achievements
Rank 1
Share this question
or