Skip to content
Browse files

Listview: added check for exisintg list when adding nested lists. Fixed

#5098 dynamic Nested lists with same parent text resolve to the sam

Listview: added check for exisintg list when adding nested lists. Fixed
#5098 dynamic Nested lists with same parent text resolve to the same
sub-page
  • Loading branch information...
1 parent 4a23aca commit 6c4acb7198b4ffc4f4a161e72fbd20446b7cc673 @alzoid committed
Showing with 29 additions and 2 deletions.
  1. +22 −0 .gitattributes
  2. +7 −2 js/widgets/listview.js
View
22 .gitattributes
@@ -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
View
9 js/widgets/listview.js
@@ -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;
@@ -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>" ),

0 comments on commit 6c4acb7

Please sign in to comment.
Something went wrong with that request. Please try again.