Iman
Iman

Reputation: 89

How can I change Kendo Grid Filter UI?

I use Grid kendo to show my data. in my query I use this field:

public Nullable Date { get; set; }

When I enable filterable i get date picker for select date. but i want this filter behavior like string . I use this code :

columns.Bound(p => p.Date).Width("10%").Title("Date").Filterable(x=>x.UI(GridFilterUIRole.Default));

and don't work correctly . so what must i do ?

Upvotes: 1

Views: 842

Answers (1)

R K Sharma
R K Sharma

Reputation: 855

col.Bound(c => c.ETA).ClientTemplate("#: kendo.toString(ETA? new Date(ETA):ETA,'MM/dd/yyyy HH:mm')#").Format("{0:MM/dd/yyyy HH:mm }").Title("ETA").HeaderHtmlAttributes(new { title = "ETA" })

ETA is a string property I am converting datetime to string in c# function at back-end.

Its not a permanent solution, but I am using this in live system and it working fine till now ;)

Edit: columns.Bound(p => p.Date).Width("10%").Title("Date").Filterable(true);

I don't know what is x=>x.UI(GridFilterUIRole.Default)

set the Date property as string type in your model so kendo grid will treat it like string. and it will pass the filter value as string to your action method too

Upvotes: 1

Related Questions