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

How do I avoid repeated ajax calls when sharing data source between 2 Kendo grids

1 Answer 24 Views
Let's talk about telerik (the good and the bad)
This is a migrated thread and some comments may be shown as answers.
littleGreenDude
Top achievements
Rank 1
littleGreenDude asked on 28 Apr 2014, 06:42 PM
I have 2 kendo grids that use the same data source. One displays zero
balance orders and the other displays orders with balances > 0. Each
one makes the same ajax call to get the full list of data and then
applies a filter for the grid (0, >0). Is there a way to have both
grids use the same datasource, but only make the ajax call once?

1 Answer, 1 is accepted

Sort by
0
littleGreenDude
Top achievements
Rank 1
answered on 28 Apr 2014, 07:06 PM
More info...

@(Html.Kendo().Grid<CustomerOrder>()
    .Name("Orders")
    .Events(events => events.DataBound("onDataBound"))
    .DataSource(dataSource => dataSource  
        .Ajax()
        .ServerOperation(false)
        .Read(read => read.Action("OrderListAjax", controller))
        .PageSize(Constants.PageSize)
        .Filter(filters => { filters.Add(c => c.CurrentOrderBalance).IsGreaterThan(0); })
        )


 

@(Html.Kendo().Grid<CustomerOrder>()
    .Name("ZeroBalanceOrders")
        .Events(events => events.DataBound("onZBdataBound"))
    .DataSource(dataSource => dataSource  
        .Ajax()
        .ServerOperation(false)
        .Read(read => read.Action("OrderListAjax", controller))
        .PageSize(Constants.PageSize)
        .Filter(filters => { filters.Add(c => c.CurrentOrderBalance).IsEqualTo(0); })
        )
    .AutoBind(false)

 

Both grids make the same call to OrderListAjax and then filter. I would
like to make the call once to retrieve the data and then apply the
filter for each grid.
Tags
Let's talk about telerik (the good and the bad)
Asked by
littleGreenDude
Top achievements
Rank 1
Answers by
littleGreenDude
Top achievements
Rank 1
Share this question
or