Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unfortunately this is not going to work. <strong><code>jQuery Mobile</code></strong> will fail to dynamically add filter to an existing listview.</p> <p>But there's a workaround. Before you populate your listview count number of elements you are trying to populate, if number is 5 or more remove current listview and append new one at the same place. This is another strange thing, if you create a listview from scratch (with filter in mind), filter is going to be successfully generated.</p> <p>I made an example for you: <a href="http://jsfiddle.net/Gajotres/SS7vJ/" rel="nofollow noreferrer">http://jsfiddle.net/Gajotres/SS7vJ/</a></p> <pre><code>$(document).on('pagebeforeshow', '#index', function(){ $('&lt;ul&gt;').attr({'id':'test-listview','data-role':'listview', 'data-filter':'true','data-filter-placeholder':'Search...'}).appendTo('#index [data-role="content"]'); $('&lt;li&gt;').append('&lt;a href="#"&gt;Audi&lt;/a&gt;').appendTo('#test-listview'); $('&lt;li&gt;').append('&lt;a href="#"&gt;Mercedes&lt;/a&gt;').appendTo('#test-listview'); $('&lt;li&gt;').append('&lt;a href="#"&gt;Opel&lt;/a&gt;').appendTo('#test-listview'); $('#test-listview').listview().listview('refresh'); }); </code></pre> <p>Also don't forget to call .listview( twice, first without refresh parameter, and second time with a refresh parameter. Without it you will receive this error:</p> <pre><code>cannot call methods on listview prior to initialization </code></pre> <p>You can find more about this problem in this <strong><a href="http://www.gajotres.net/jquery-mobile-and-how-to-enhance-the-markup-of-dynamically-added-content/" rel="nofollow noreferrer">ARTICLE</a></strong>, to be transparent it is my personal blog. Or find it <strong><a href="https://stackoverflow.com/a/14550417/1848600">HERE</a></strong>. Look for the chapter called: <strong>Markup enhancement problems</strong>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload