Permalink
Browse files

fix refresh bug for new options of the same number as before

  • Loading branch information...
1 parent 2c55c93 commit 59fc26d25f8212946fa94fe3a8e6ff8bcb7ee370 @johnbender johnbender committed Sep 9, 2011
Showing with 12 additions and 2 deletions.
  1. +12 −2 js/jquery.mobile.forms.select.custom.js
@@ -202,7 +202,17 @@
});
},
- refresh: function( forceRebuild ){
+ _isRebuildRequired: function() {
+ var list = this.list.find( "li" ),
+ options = this._selectOptions();
+
+ // TODO exceedingly naive method to determine difference
+ // ignores value changes etc in favor of a forcedRebuild
+ // from the user in the refresh method
+ return options.text() !== list.text();
+ },
+
+ refresh: function( forceRebuild , foo ){
var self = this,
select = this.element,
isMultiple = this.isMultiple,
@@ -211,7 +221,7 @@
// return an array of all selected index's
indicies = this.selectedIndices();
- if ( forceRebuild || select[0].options.length != self.list.find( "li" ).length ) {
+ if ( forceRebuild || this._isRebuildRequired() ) {
self._buildList();
}

0 comments on commit 59fc26d

Please sign in to comment.