Filter Trouble

6 posts, 0 answers
  1. Werit
    Werit avatar
    8 posts
    Member since:
    Jan 2012

    Posted 16 Jan 2012 Link to this post

    This doesn't seem to return anything (Should show Jane), am I using Filters incorrectly?

    var stuff = [
                      {
                          FirstName: "Joe",
                          LastName: "Smith"
                      },
                      {
                          FirstName: "Jane",
                          LastName: "Smith"
                  }];
     
     var ds = new kendo.data.DataSource({data: stuff});   
     
    $("#grid").kendoGrid({
              columns:[
                  {
                      field: "FirstName",
                      title: "First Name"
                  },
                  {
                      field: "LastName",
                      title: "Last Name"
              }],
              dataSource: ds.filter([{ field: "FirstName", operator: "neq", value: "Joe" }])
     
    });
  2. John DeVight
    John DeVight avatar
    209 posts
    Member since:
    Jan 2010

    Posted 16 Jan 2012 Link to this post

    Hi Werit,

    The filter has some square brackets that shouldn't be there.  Also, I would move the call to the dataSource filter function to be defined before binding to the grid, and then the grid just binds to the dataSource:

    var stuff = [
                      {
                          FirstName: "Joe",
                          LastName: "Smith"
                      },
                      {
                          FirstName: "Jane",
                          LastName: "Smith"
                  }];
       
    var ds = new kendo.data.DataSource({data: stuff});    
      
    ds.filter({ field: "FirstName", operator: "neq", value: "Joe" });
      
    $("#grid").kendoGrid({
              columns:[
                  {
                      field: "FirstName",
                      title: "First Name"
                  },
                  {
                      field: "LastName",
                      title: "Last Name"
              }],
              dataSource: ds
    });

    Hope this helps....

    Regards,

    John DeVight
  3. Kendo UI is VS 2017 Ready
  4. Werit
    Werit avatar
    8 posts
    Member since:
    Jan 2012

    Posted 17 Jan 2012 Link to this post

    Thanks,  I guess I was just thinking about filters wring.  Is it possible to do filtering at the UI level instead of the Datasource?
  5. John DeVight
    John DeVight avatar
    209 posts
    Member since:
    Jan 2010

    Posted 17 Jan 2012 Link to this post

    Hi Werit,

    Are you thinking of something like the Telerik Extensions for MVC Grid?  If so, I don't think that Kendo has anything like that yet.  You could periodically check the Readmap as well as post a request at: Kendo UI Feedback requesting the feature.  If you do post a request, let me know and I'll vote for it as well =)

    Regards,

    John DeVight
  6. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 17 Jan 2012 Link to this post

    Hello,

     Grid filtering is already supported. Check this demo: http://demos.kendoui.com/web/grid/local-data.html 

    Greetings,
    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. John DeVight
    John DeVight avatar
    209 posts
    Member since:
    Jan 2010

    Posted 17 Jan 2012 Link to this post

    LOL

    Thanks Atanas.  No idea how I missed that! =)
Back to Top
Kendo UI is VS 2017 Ready