Pushpender
Top achievements
Rank 1
Pushpender
asked on 28 Mar 2014, 12:43 PM
Is there any way to get the count of number of items matching the filter criteria in a ListView?
4 Answers, 1 is accepted
0
Hi Pushpender,
You can use the view() of the dataSource, that will return only the items, that are left after filtering, and you can get its length property. I have created an example, showing a possible implementation:
http://jsbin.com/jotarija/1/edit
Regards,
Kiril Nikolov
Telerik
You can use the view() of the dataSource, that will return only the items, that are left after filtering, and you can get its length property. I have created an example, showing a possible implementation:
http://jsbin.com/jotarija/1/edit
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Pushpender
Top achievements
Rank 1
answered on 01 Apr 2014, 05:36 AM
Hey thanks for the quick reply. That does gives me a count of items in the ListView.
Can we call an event when the ListView is filtered based on the search criteria? In the example provided, it was on the button click. Whereas, I want to bind it to the ListView Filter Event.
Can we call an event when the ListView is filtered based on the search criteria? In the example provided, it was on the button click. Whereas, I want to bind it to the ListView Filter Event.
0
Pushpender
Top achievements
Rank 1
answered on 01 Apr 2014, 06:09 AM
I implemented it in "DataBind" event of ListView. Is this approach correct?
dataBound: function(e) {
var contactDataSource = this.dataSource;
if(contactDataSource.view().length == 0){
navigator.notification.alert("No result found", function () {}, "", 'OK');
}
}
dataBound: function(e) {
var contactDataSource = this.dataSource;
if(contactDataSource.view().length == 0){
navigator.notification.alert("No result found", function () {}, "", 'OK');
}
}
0
Accepted
Hi Pushpender,
Using dataBound event is perfectly fine, so you can go ahead and use it as the event will be fired every time the ListView is filtered.
Regards,
Kiril Nikolov
Telerik
Using dataBound event is perfectly fine, so you can go ahead and use it as the event will be fired every time the ListView is filtered.
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!