Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Listview('refresh') does not update the icons of list items #8334

Closed
lukaseckert opened this issue Nov 24, 2015 · 3 comments
Closed

Listview('refresh') does not update the icons of list items #8334

lukaseckert opened this issue Nov 24, 2015 · 3 comments

Comments

@lukaseckert
Copy link

See
http://jsfiddle.net/us0egzdq/1/

I have a listview and would like to change the icon of one of it's entries after initialization (when the user clicks on it). Although the data-icon attribute of the < li > element is changed by the script, the listview('refresh') command will not update the icon class of the nested < a > element, so the new icon does not become visible.

Tested with jQM 1.4.5

@AHorak
Copy link

AHorak commented Jan 27, 2016

Any workaround for that?

@apsdehal
Copy link
Contributor

Confirmed, for now you can manually remove ui icon class and add other one for workaround.

@gabrielschulhof
Copy link

  • Add method updateItems() with optional collection which does sparing refresh() if the collection is not given and restricts itself to the collection if it is given.
  • Change refresh() to agressively update all items and deprecate sparing refresh()

gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 28, 2016
gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 28, 2016
gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 28, 2016
gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 28, 2016
gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 28, 2016
gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 28, 2016
gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 29, 2016
  1. Fix signature of public refresh() method

  2. Move sparing _refresh() decision to backcompat

     The decision is delegated to extension points (one for the list item and
     one the anchor(s) it may contain) which are predicates that always return
     true if the backcompat extension is absent, indicating for every item that
     it is to be processed.

     When the backcompat extension is present, the extension points contain the
     class-examining regex-based decision of previous versions.

  3. Add method updateItems()

     In _refresh() we still need to retrieve all list items, even when we get a
     list of items from updateItems(), because the followings require global
     knowledge:

       - Which items have been removed since last time, so we can untrack them

       - Which is the first resp. last item for use with addFirstLastClasses()

Closes jquery-archivegh-8489
Fixes jquery-archivegh-8334
gabrielschulhof pushed a commit to gabrielschulhof/jquery-mobile that referenced this issue Jul 29, 2016
  1. Fix signature of public refresh() method

  2. Move sparing _refresh() decision to backcompat

     The decision is delegated to extension points (one for the list item and
     one the anchor(s) it may contain) which are predicates that always return
     true if the backcompat extension is absent, indicating for every item that
     it is to be processed.

     When the backcompat extension is present, the extension points contain the
     class-examining regex-based decision of previous versions.

  3. Add method updateItems()

     In _refresh() we still need to retrieve all list items, even when we get a
     list of items from updateItems(), because the followings require global
     knowledge:

       - Which items have been removed since last time, so we can untrack them

       - Which is the first resp. last item for use with addFirstLastClasses()

Closes jquery-archivegh-8489
Fixes jquery-archivegh-8334
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants