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

Placeholder for Filter controls in mvc grid

3 Answers 551 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vidya
Top achievements
Rank 1
Vidya asked on 09 Jun 2016, 01:48 PM
How to add placeholder for all the filter text boxes in the grid. For date columns the filter text box should show the date format like mm\dd\yyyy. How to achieve this for all columns in the grid?

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 13 Jun 2016, 09:00 AM

Hello Vidya,

In order to customize the filter input element a template should be used. I assume that you are using filter row mode. If so the columns.filterable.cell.template should be used. Otherwise the columns.filterable.cell.template function should be used. 

The ultimate goal is user to be able to define the input element and set its placeholder option.  

Regards,
Boyan Dimitrov
Telerik
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Vidya
Top achievements
Rank 1
answered on 13 Jun 2016, 04:55 PM

Hi,

Can you post some example of setting placeholder in MVC grid. 

Thanks

0
Boyan Dimitrov
Telerik team
answered on 15 Jun 2016, 11:26 AM

Hello Vidya,

Please refer to the code snippets below: 

columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}").Filterable(ftb => ftb.Cell(cell => cell.Template("customDatePicker")));

function customDatePicker(args) {
    args.element.attr("placeholder", "mmddyyyy");
    args.element.kendoDatePicker();       
}

The Grid / Filter row is used as a base example. 

Regards,
Boyan Dimitrov
Telerik
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Vidya
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Vidya
Top achievements
Rank 1
Share this question
or