1

I want to show a message when a jQuery mobile ListView has no elements. For example: "There are no elements." How can I do it?

2
  • A listview that is dynamically generated? or a listview that uses filtering? Commented Jan 15, 2013 at 17:58
  • @andleer a list view that is dynamically generated. Commented Jan 15, 2013 at 17:59

2 Answers 2

2

If you are dynamically generating your listview and find no rows to display, why not simply display a row with a message stating as much?

<ul data-role="listview" data-inset="true">
    <li data-role="list-divider">Results</li>
    <li>No records found</li>
</ul>

http://jsbin.com/eyozis/1/edit

Sign up to request clarification or add additional context in comments.

Comments

1

Use a popup to show warning:

$('#index').live('pagebeforeshow',function(e,data){   
    if($('#test-list li').length === 0){
        setTimeout(function(){$('#MyFirstPopup').popup('open');},100);
    }
});

Here's an working example: http://jsfiddle.net/Gajotres/wy5R3/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.