You can change any data-attribute before pageinit (for example, on pagecreate) and it will take effect.
Once the page has been created, in general, any changes to data- attributes in widgets will be ignored. data- attributes generally just control how the widget is initially constructed. Depending on the particular data- attributes present at the time that the widget is created, different HTML structure might be created, or different classes might be applied - to the widget element itself, or to child elements.
One approach some have taken is to remove and re-insert the element, and re-create the widget, but this might have undesirable side-effects. (Especially here, where you would have to do this with an entire listview.)
In many cases, you might be able to achieve the same thing by changing some class(s). You would need to take a close look at the generated HTML and classes to see what is different between a widget with the value "true" vs "false".
In other cases, the value of the data- element might result in different HTML being generated. Again, you can determine this by looking closely at the generated HTML and classes. (Use WebInspector, Firebug, etc.) You could modify the HTML yourself with code to achieve the change.
Unfortunately, this is all poorly documented if at all. Widgets are just "magic" and there isn't much explanation as to just how they work. I'm afraid it's up to you as a developer to figure it out. That's just the unfortunate state of JQM documentation.
The developers have tried to anticipate common use cases. Once you go beyond what has been provided, it can get very difficult. Often, the best approach is to not use a widget at all, and just use Plain Old HTML and your own CSS classes. For example, IMO, listviews just don't belong in apps or webapps that are required to perform well with anything more than very small-sized lists.
I increasing view JQM widgets as prototyping tools. They are a way to create nice-looking pages quickly, but if you want to get fancy or have good performance, you will eventually need to replace them with your own custom HTML/CSS.
Leave a comment on watusiware's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic