opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

styling gets lost when toggling visibiliy of elements in listview #125

Closed marcorinck closed 11 years ago

marcorinck commented 11 years ago

Hi,

I have some anchors in a listview which I can toggle to display them or not. They get rendered fine when displaying the listview for the first time.

After the first full toggle (not displaying, displaying again) the styling of the anchors is lost.

See this fiddle: http://jsfiddle.net/marcorinck/nU5pc/ (click toggle button twice)

Interestingly, the styling is correct again, when an item attributes in the controller are changed. Click button "change one" in the fiddle after styling is corrupt.

tbosch commented 11 years ago

Hi, yes, I can verify this for ngm-if. A workaround is to use ng-show, which does not really remove the elements from the list but just hides them.

Tobias

tbosch commented 11 years ago

Problem is the extra css class ui-li-static on the <li> elements...

tbosch commented 11 years ago

Minimal page to reproduce this:

<div id="main" data-role="page">
     <div data-role="content">
         <ul data-role="listview">
             <li>
                 <a ngm-if="true">Hello</a>
             </li>
         </ul>
     </div>
</div>
tbosch commented 11 years ago

Hi, this is a problem with the refresh function of the jquery mobile listview widget. Rows without links are marked with ui-li-static. If the row is changed afterwards to contain a link and $(el).listview("refresh") is called, the ui-li-static marker is not removed.

However, the adapter already contains a fix for refreshing listviews, so I update that patch :-)

Tobias

tbosch commented 11 years ago

Here is an updated jsfiddle: http://jsfiddle.net/nU5pc/4/