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

How to show an "Empty list view" template

2 Answers 473 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Ruud
Top achievements
Rank 1
Ruud asked on 23 Nov 2014, 11:59 AM
Hi,
What is the best approach to create a mechanic to show an "No results found" template for a mobile list view? Of course, I could use client side script for this, but I'm just wondering if there is another, more generic way of doing this..

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 26 Nov 2014, 09:05 AM
Hi Ruud,

Thank you for contacting us.

Mobile ListView do not have a build-in template that will be displayed when there are no items. I assume that you are binding the widget to a remote DataSource via Ajax. Is that correct? In such case please use a client side script - all you need to do is to hook up to the dataBound event of the ListView and check if dataSource.data().length is equal to zero. If the condition is true append a dummy ListView item that notifies the user that there are no records.

The dummy record will be automatically removed when the dataSource changes (for example when the user searches for another word).

I hope this approach will fit in your scenario.

Regards,
Alexander Valchev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ruud
Top achievements
Rank 1
answered on 05 Mar 2015, 08:27 AM
Hi,
Thanks for your email. I did do the check in the databound event to conditionally show/hide a div with the text" nothing found". So thanks for your suggestion!
Tags
ListView (Mobile)
Asked by
Ruud
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Ruud
Top achievements
Rank 1
Share this question
or