How do I do sorting if I'm binding to a json file?

2 posts, 0 answers
  1. Brett
    Brett avatar
    7 posts
    Member since:
    Jun 2020

    Posted 25 Aug 2020 Link to this post

    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?

     

  2. Hetali
    Admin
    Hetali avatar
    75 posts

    Posted 27 Aug 2020 Link to this post

    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).

Back to Top