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

How to use cell templates with remote datasources?

3 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CCG
Top achievements
Rank 2
CCG asked on 10 Sep 2015, 09:44 AM

I'm trying to use a custom UI element in my filter row in the grid, but I am having problems with my remote datasource.

The documentation states "Keep in mind that the passed dataSource instance may still not be populated at the time the template function is called, if the Grid uses remote binding", and the datasource received in the template function is indeed undefined.

Is there a way to update the filter templates when the datasource has finished fetching the data?

3 Answers, 1 is accepted

Sort by
0
Plamen Lazarov
Telerik team
answered on 12 Sep 2015, 02:22 PM

Hello JH,

It seems there are some gaps in the documentation for the columns.filterable.cell.template configuration - it works only with string values at this point. We will update the documentation in a timely manner. 

Regards,
Plamen Lazarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
CCG
Top achievements
Rank 2
answered on 14 Sep 2015, 08:31 AM

Hi,

Okay, so if it is another data type then no datasource is passed to the template function?

I still have issues with updating the filter control when the data changes, though, even ​when I use it with string values. I put together this dojo demonstrating the issue. Is there anyway to refresh the filter template when the grid data is refreshed?

Thanks in advance.

Regards,
JH

0
Plamen Lazarov
Telerik team
answered on 16 Sep 2015, 09:02 AM

Hi JH,

Yes, a dataSource is not passed in the template function arguments when the field type is not string. The idea is that non-string fields do not need or use dropdown-like filtering. For example, a numeric field would use a NumericTextBox, a date field would use a DatePicker, etc. These widgets do not need a dataSource.

In order to reset the current filter when the Grid dataSoruce is changed, you can add the following line in the click event handler for the "Reset data" button: 

$("#grid").data("kendoGrid").dataSource.filter([]);

Please keep in mind that if the DropDownList dataSource needs to be changed, you should do this manually, since the Grid is not aware of what's in the template.

Regards,
Plamen Lazarov
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
CCG
Top achievements
Rank 2
Answers by
Plamen Lazarov
Telerik team
CCG
Top achievements
Rank 2
Share this question
or