[SOLVED] Append items to List View, new items not in DOM?

Hi
I’m new to FW7, just downloaded and try to test it. Looks very good so fare :slight_smile:

I have this “List view” and I want to add new items after app is intialized.
I use something like this code when users add items inside the app.

var myVar = '
tons of html
\n'; myVar += '
tons of html
\n'; myVar += '
tons of data from JSON
\n';

$$(’#myListviewID’).append(myVar);

This updates and inserts into “List view” just nice, but new item are not searchable, I assume they are not in DOM?

Is there a better approach to this?

I have also tried this with no luck:
$$(’#myListviewID’).append($$(myVar));

Thanks
Henning

Do you see items added in list visually? Then they are in DOM? What do you mean not searchable?

Yes, they are in the list visually.

I made a short video where I search for new items.

Video here

look like your layout is something like this:

<div class="page">
  <div class="navbar">
    <div class="navbar-inner">
      <form data-search-container=".my-list"></form>
    </div>
  </div>
  <div class="page-content">
    <div class="list my-list searchbar-found">
      <ul>
        <li>
          <a class="item-content item-link">
            <div class="item-inner">
              <div class="item-title">Static</div>
            </div>
          </a>
        </li>
      </ul>
    </div>
    <div class="list">
      <ul id="myListviewID">
      </ul>
    </div>
  </div>
</div>

just add “my-list searchbar-found” to the second-list

or append the new-items to the first-list

$$('.list.my-list ul').append(myVar);

and try out template7
it will save you a lot of useless/unreadable code

Thanks, it helped “talking” about it.
it turns out i have mixed up som /divs so new items was not in the list.

It works fine now.

I will have a look at templates :slight_smile: