0

I've created a list of messages dynamically. I have a <ul> tag and I'm generating a list inside dynamically. However, I don't know how to add list dividers to this. Would there be a refresh method in js that I can call which would add dividers after I have my list?

This is what I have:

<ul id="messages" data-autodividers="true" data-role="listview" data-theme="c">

    //a list of <li> are dynamically generated here

</ul>

This only appends on list divider to the very top, I need several of them within the <li> tags. My list of <li>'s are messages. I want to be able to have dividers by Date so it makes it much easier to use.

dfsq
  • 182,609
  • 24
  • 222
  • 242
DannyD
  • 2,358
  • 15
  • 43
  • 63
  • Have you read JQM docs? http://jquerymobile.com/demos/1.2.1/docs/lists/lists-divider.html – Ateszki Mar 20 '13 at 15:00
  • yes, however there isn't a scenario for when you already have a list generated and want to go in after and add list-dividers – DannyD Mar 20 '13 at 15:02
  • Can you add the dividers dynamically when you inject the messages? You can also add the dividers later and refresh the list $('#mylist').listview('refresh'); – Ateszki Mar 20 '13 at 15:04
  • I'm using a js function which calls a html template with my
  • tag, and I can't seem to add a divider since I would need to know the whole list before adding them. If I do refresh in the way you are saying, how would I then refresh it with dividers?
  • – DannyD Mar 20 '13 at 15:12