Roo/bootstrap/ComboBox.js
[roojs1] / Roo / bootstrap / ComboBox.js
index dbfe5f8..ee0c049 100644 (file)
@@ -106,8 +106,13 @@ Roo.bootstrap.ComboBox = function(config){
             * @param {Roo.bootstrap.ComboBox} combo This combo box
             * @param {Object} cfg set html .
             */
-        'touchviewdisplay' : true
-        
+        'touchviewdisplay' : true,
+        /**
+         * @event ontouchviewload
+         * Fires when touch view load (local store)
+         * @param {Roo.bootstrap.ComboBox} combo This combo box
+        */
+        'ontouchviewload' : true
     });
     
     this.item = [];
@@ -960,11 +965,16 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
         this.list.on('scroll', this.onViewScroll, this);
         
         if(!this.tpl){
-            this.tpl = '<li class="roo-select2-result"><div class="checkbox"><input id="{roo-id}" type="checkbox" {roo-data-checked}><label for="{roo-id}"><b>{' + this.displayField + '}</b></label></div></li>';
+            this.tpl = '<li class="roo-select2-result"><div class="checkbox"><input id="{roo-id}"' + 
+                'type="checkbox" {roo-data-checked}><label for="{roo-id}"><b>{' + this.displayField + '}</b></label></div></li>';
         }
 
         this.view = new Roo.View(this.list, this.tpl, {
-            singleSelect:true, tickable:true, parent:this, store: this.store, selectedClass: this.selectedClass
+            singleSelect:true,
+            tickable:true,
+            parent:this,
+            store: this.store,
+            selectedClass: this.selectedClass
         });
         
         //this.view.wrapEl.setDisplayed(false);
@@ -1143,7 +1153,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
         if(typeof(this.loading) !== 'undefined' && this.loading !== null){
             this.loading.hide();
         }
-        Roo.log(this.store.getCount());
+        
         if(this.store.getCount() > 0){
             
             this.expand();
@@ -1513,6 +1523,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
     onEmptyResults : function(){
         
         if(this.tickable && this.editable){
+            this.hasFocus = false;
             this.restrictHeight();
             return;
         }
@@ -1657,7 +1668,6 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
             if(this.lastQuery != q || this.alwaysQuery){
                 this.lastQuery = q;
                 if(this.mode == 'local'){
-                    
                     this.selectedIndex = -1;
                     if(forceAll){
                         this.store.clearFilter();
@@ -1676,6 +1686,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
                     
                     this.onLoad();
                     
+                    
                 }else{
                     
                     this.store.baseParams[this.queryParam] = q;
@@ -2129,6 +2140,10 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
     
     validate : function()
     {
+        if(this.getVisibilityEl().hasClass('hidden')){
+            return true;
+        }
+        
         var v = this.getRawValue();
         
         if(this.multiple){
@@ -2716,6 +2731,8 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
             (function() { firstChecked.findParent('li').scrollIntoView(_this.touchViewListGroup.dom); }).defer(500);
         }
         
+        this.fireEvent('ontouchviewload', this);
+        
     },
     
     onTouchViewLoadException : function()