Filtering ListView dataSource

5 posts, 2 answers
  1. Amrutha
    Amrutha avatar
    21 posts
    Member since:
    Apr 2012

    Posted 05 Aug 2013 Link to this post

    Hi,

     In my application I am populating a ListView using a service call. I am adding a TextBox and a filter button in the navbar of that page. I have filtered the ListView using the following method.

     function filter(){
            var listView = $("#SubFolderList").data("kendoMobileListView");
            listView.dataSource.filter({ field: "ItemName", operator: "contains", value: SearchValue });
            //here i need the count of the items
     } 

    I have a clear filter button near to the filter button, I want to clear the filter on pressing the clear button.

    Please help me finding a solution with service call

    Thanks,
    Amrutha.
  2. Answer
    David Silveria
    David Silveria avatar
    234 posts
    Member since:
    May 2006

    Posted 05 Aug 2013 Link to this post

    To remove the filter, simply call the filter() method of the datasource with no arguments - this would remove any existing filters e.g.:

    clearTheFilter: function () {
                //Clear Filter
                dataSource.filter({});
            }
  3. Amrutha
    Amrutha avatar
    21 posts
    Member since:
    Apr 2012

    Posted 05 Aug 2013 Link to this post

    Thanks for the answer... It worked. Can you please help me to find the count of data after filtering.

    Thanks,
    Amrutha
  4. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 06 Aug 2013 Link to this post

    Hi Amrutha,

    You can use the view method of the datasource which correspond to the current page, filter, sort and group configuration e.g. dataSource.view().length. If you have paging applied, you can use kendo.data.Query.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  5. Amrutha
    Amrutha avatar
    21 posts
    Member since:
    Apr 2012

    Posted 07 Aug 2013 Link to this post

    Thanks Steve..
Back to Top