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

From Regular Kendo selector code to Razor

1 Answer 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Veteran
Ed asked on 25 Oct 2020, 03:21 AM

Ho Do I tranform this code in the @(Html.Kendo()) razor mvc style?

 

$("#grid").data("kendoGrid").dataSource.filter({
field: "date",
//create custom filter operator
operator: function(fieldDate) {

var parsedSelectedDate = kendo.parseDate(selectedDate);
//parse the field date in order to ignore the time
var parsedFieldDate = new Date(fieldDate.getFullYear(),  fieldDate.getMonth(), fieldDate.getDate());
var result = (parsedFieldDate.getTime() == parsedSelectedDate.getTime());

return result;

},
value: selectedDate
});

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 27 Oct 2020, 12:12 PM

Hello Ed, 

 

This code is a call to the filter() method which is not a Configuration setting and thus does not have an MVC equivalent. It is plainly a JavaScript action code:
https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/filter

Let me know if you want to achieve something additional.

 

Regards,
Eyup
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Ed
Top achievements
Rank 1
Veteran
Answers by
Eyup
Telerik team
Share this question
or