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

Listview: added check for existing list when adding nested lists. Fixed #5098 dynamic Nested lists with same parent text resolve to the same sub-page #5106

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
9 changes: 7 additions & 2 deletions js/widgets/listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,12 @@ $.widget( "mobile.listview", $.mobile.widget, {
dns = "data-" + $.mobile.ns,
self = this,
persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" ),
hasSubPages;
hasSubPages,
listToRenderLength,
currentListLength;

listToRenderLength = parentList.find( "li>ul, li>ol" ).toArray().length;
currentListLength = $( parentList ).children("li").length;

if ( typeof listCountPerPage[ parentId ] === "undefined" ) {
listCountPerPage[ parentId ] = -1;
Expand All @@ -367,7 +372,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
$( parentList.find( "li>ul, li>ol" ).toArray().reverse() ).each(function( i ) {
var self = this,
list = $( this ),
listId = list.attr( "id" ) || parentListId + "-" + i,
listId = list.attr( "id" ) || parentListId + "-" + ( listToRenderLength < currentListLength ? currentListLength-listToRenderLength : i ),
parent = list.parent(),
nodeElsFull = $( list.prevAll().toArray().reverse() ),
nodeEls = nodeElsFull.length ? nodeElsFull : $( "<span>" + $.trim(parent.contents()[ 0 ].nodeValue) + "</span>" ),
Expand Down