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

Dynamically insert thumbnail item at 0-index position doesn't update all style after listview refresh #1394

Closed
wants to merge 3 commits into from

Conversation

ray58750034
Copy link
Contributor

Dynamically insert thumbnail item at the top of listview, then call listview('refresh'), not all styles applied to the inserted item (for me, 'ui-li-thumb' and 'ui-li-has-thumb' class not applied).

After some investigation, I found some codes in '_itemApply' of 'jquery.mobile.listview.js' doesn't work for first dynamically added item.

The commits including 2 file changes, one is a functional test that can reproduce this issue, another is my solution to this issue.

2. add thumbnail class to 'item' parameter of _itemApply, instead of using 'li' selector
@scottbw
Copy link

scottbw commented Apr 12, 2011

I've come across exactly the same issue - after an Ajax call that updates a listview with thumbnails, calling listview('refresh') updates the styles of all of the list items apart from the first item in the list,.

@hakanson
Copy link
Contributor

Is this the same problem as #1016 from @thiagofesta ?

@ray58750034
Copy link
Contributor Author

Yep, my case is exactly same as @shazron commented in #1016.

@msbsh
Copy link

msbsh commented Jun 8, 2011

I guess the pull request does not fix the problem, or to be more precise, introduces a new bug.
It would for example set ui-li-thumb to the image in the following example.

<li>
    <h3>description</h3>
    <p>
        <img src="image.png"/>
        some text
    </p>
</li>

Yet, this is not the intended design as it corrupts the whole listview.

@ray58750034
Copy link
Contributor Author

I noticed some commits maybe already fixed this issue, not very sure about that because I'm still waiting for beta release and never merge any code from new commits more.

I will test my product in jquerymobile beta, if beta fix this case, I will close this pull request.

@scottjehl
Copy link

Hi ray58750034,
Thanks for the pull. The issue you describe is probably not something we'll be able to address across all of the markup variations in listviews. The refresh method is meant to bring newly-appended list items into the style of the rest of the listview, but it would be very complex to make it refresh existing LIs that have been modified. In this situation, we'd recommend scripting the updates manually.

I'll add this to the feature requests wiki though, for future consideration. Thanks for submitting!

@scottjehl scottjehl closed this Jul 11, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants