This is a migrated thread and some comments may be shown as answers.
How do I do sorting if I'm binding to a json file?
1 Answer 2 Views
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 1
Brett asked on 25 Aug 2020, 10:15 PM

Due to some performance issues on the application.  I need to do the binding via a json file instead of using an api.  However, I was running into an issue doing sorting/filtering.

The application displays a list of data.  It needs to filter data by a date range.  

Could someone provide me a direction on what I need to do?

 

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 27 Aug 2020, 09:39 PM

Hello Brett,

In order to add sorting and filtering feature in the Kendo UI Grid, set the sortable and filterable property to true. To filter the data by a date range, you can add the less than and the greater than operator for the date column. For example:

$("#grid").kendoGrid({
  sortable: true,
  filterable: {
    operators: {
      date: {
        gt: "After",
        lt: "Before"
      }
    }
  }
});

Please take a look at the attached zip file where the Kendo UI Grid is extracting data from a local JSON file and performing sort and filter operations.

To see the file running without any CORS error, use the http-server as seen in this screen recording.

Please let me know if this helps or if I can further assist you.

Regards,
Hetali
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Tags
Grid
Asked by
Brett
Top achievements
Rank 1
Answers by
Hetali
Telerik team
Share this question
or