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

Preload filterable data

2 Answers 253 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 30 Sep 2015, 07:31 PM

In my grid, I am using filterable and the data is fetched asynchronously when the user clicks on the down arrow in the column header. I would like to pre-fetch that data as soon as the grid data is requested - so that the user will most likely not see the spinner while the user waits for data.  Currently, the data is not requested until the user clicks on the down arrow.

 

The column configuration is as follows:

 

{ field: "CompanyName", title: "Company Name", width: 168, filterable: { multi: true, dataSource: { transport: { read: { url: "/api/LoadGridDataUnique", data: { field: "CompanyName"}}}}} }

2 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 30 Sep 2015, 07:58 PM

I tried the following after the call to initialize the grid, but got ​the error: Uncaught TypeError: val.filterable.dataSource.read is not a function

So, how do I prefetch the filterable data for the multi filterable dropdowns?

var grid = $("#myGrid").data("kendoGrid");
$.each(grid.columns, function(idx, val) {
    if (val.filterable && val.filterable.dataSource) {
        val.filterable.dataSource.read();
    }
});

0
Boyan Dimitrov
Telerik team
answered on 02 Oct 2015, 11:26 AM

Hello Ed,

The filtermulticheck widget is initialized for each column header (th) element. So basically if you have a column "FirstName"in your Kendo UI Grid in order to call the read method for the filtermulticheck widget use the following code: 

$("th[data-field='FirstName']").data().kendoFilterMultiCheck.checkSource.read()

 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Ed
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or