Skip to content

Commit

Permalink
Listview: added check for exisintg list when adding nested lists. Fixed
Browse files Browse the repository at this point in the history
jquery-archive#5098 dynamic Nested lists with same parent text resolve to the sam

Listview: added check for exisintg list when adding nested lists. Fixed
jquery-archive#5098 dynamic Nested lists with same parent text resolve to the same
sub-page
  • Loading branch information
alzoid committed Sep 28, 2012
1 parent 4a23aca commit 6c4acb7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .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
9 changes: 7 additions & 2 deletions js/widgets/listview.js
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

0 comments on commit 6c4acb7

Please sign in to comment.