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

Filtering ListView dataSource

4 Answers 605 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Amrutha
Top achievements
Rank 1
Amrutha asked on 05 Aug 2013, 06:35 AM
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.

4 Answers, 1 is accepted

Sort by
0
Accepted
David Silveria
Top achievements
Rank 1
answered on 05 Aug 2013, 07:39 AM
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({});
        }
0
Amrutha
Top achievements
Rank 1
answered on 05 Aug 2013, 10:12 AM
Thanks for the answer... It worked. Can you please help me to find the count of data after filtering.

Thanks,
Amrutha
0
Accepted
Steve
Telerik team
answered on 06 Aug 2013, 03:58 PM
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.
0
Amrutha
Top achievements
Rank 1
answered on 07 Aug 2013, 08:31 AM
Thanks Steve..
Tags
General Discussions
Asked by
Amrutha
Top achievements
Rank 1
Answers by
David Silveria
Top achievements
Rank 1
Amrutha
Top achievements
Rank 1
Steve
Telerik team
Share this question
or