You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
When appending the li element dynamically the sub-page indices are incorrect. It duplicates the indices starting over at 0 instead of using the next incremented index. This causes the original page with index 0 and the new page with index 0 to display as active and stack over one another
The text was updated successfully, but these errors were encountered:
I have done some research and found that _createSubPages does not count if there are already items in the list you are adding to.
I added the 2 variables :
parentLength,childLength
and set them as follows
parentLength=parentList.find("li>ul, li>ol").toArray().length;childLength=$(parentList).children("li").length;$(parentList.find("li>ul, li>ol").toArray().reverse()).each(function(i){//this is the build loop//.//removed code for simplicity//.//on this line i addedlistId=list.attr("id")||parentListId+"-"+(parentLength<childLength?childLength-parentLength:i),}
And that fixed the problem. I think there are issues when adding to a nested list as well which I am investigating. I am new to the jquery mobile project so I don;t know if my code is inline with your standards, maybe a someone with more project knowledge could verify this fix.
alzoid
added a commit
to alzoid/jquery-mobile
that referenced
this issue
Sep 28, 2012
jquery-archive#5098 dynamic Nested lists with same parent text resolve to the sam
Listview: added check for exisintg list when adding nested lists. Fixedjquery-archive#5098 dynamic Nested lists with same parent text resolve to the same
sub-page
Related to:
JS Fiddle:
StackOverFlow:
When appending the li element dynamically the sub-page indices are incorrect. It duplicates the indices starting over at 0 instead of using the next incremented index. This causes the original page with index 0 and the new page with index 0 to display as active and stack over one another
The text was updated successfully, but these errors were encountered: