roojs-bootstrap.js
authoredward <edward@roojs.com>
Mon, 9 Nov 2015 08:54:28 +0000 (16:54 +0800)
committeredward <edward@roojs.com>
Mon, 9 Nov 2015 08:54:28 +0000 (16:54 +0800)
roojs-bootstrap-debug.js
roojs-core.js
roojs-core-debug.js
roojs-ui.js
roojs-ui-debug.js
roojs-all.js
roojs-debug.js

roojs-all.js
roojs-bootstrap-debug.js
roojs-bootstrap.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 2c99ed5..7b6cef1 100644 (file)
@@ -427,9 +427,7 @@ this.fireEvent("loadexception",this,o,A,o.raw.errorMsg);return;}var r=o.records,
 this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else {this.totalLength=Math.max(t,this.data.length+r.length);this.add(r);}
 this.fireEvent("load",this,r,A,o);if(A.callback){A.callback.call(A.scope||this,r,A,true);}},loadData:function(o,A){var r=this.reader.readRecords(o);this.loadRecords(r,{add:A},true);},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;},getSortState:function(){return this.sortInfo;},applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);};this.data.sort(s.direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(s.direction,fn);}}},setDefaultSort:function(A,B){this.sortInfo={field:A,direction:B?B.toUpperCase():"ASC"};},sort:function(A,B){var f=this.fields.get(A);if(!B){this.sortToggle[f.name]=this.sortToggle[f.name]||f.sortDir;if(this.multiSort||(this.sortInfo&&this.sortInfo.field==f.name)){B=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");}else {B=f.sortDir;}}
 this.sortToggle[f.name]=B;this.sortInfo={field:f.name,direction:B};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else {this.load(this.lastOptions);}},each:function(fn,A){this.data.each(fn,A);},getModifiedRecords:function(){return this.modified;},createFilterFn:function(A,B,C){if(!B.exec){B=String(B);if(B.length==0){return false;}
-B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){if(typeof(A)=='string'){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();}var fn=[];var D=[];var E=this;Roo.each(A,function(p){if(C==true){D.push(E.createFilterFn(p,B,true));}
-fn.push(E.createFilterFn(p,B,false));});if(!fn.length&&!D.length){return this.clearFilter();}
-this.snapshot=this.snapshot||this.data;var F=[];Roo.each(fn,function(f){F.push(E.queryBy(f,E));});Roo.each(D,function(f){F.push(E.queryBy(f,E));});var G=this.snapshot||this.data;var r=new Roo.util.MixedCollection();r.getKey=G.getKey;var H=[];Roo.each(F,function(d){var k=d.keys,it=d.items;for(var i=0,I=it.length;i<I;i++){if(H.indexOf(k[i])==-1){r.add(k[i],it[i]);}}});this.data=r;this.fireEvent("datachanged",this);},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
+B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
 this.fireEvent("update",this,A,Roo.data.Record.EDIT);},afterReject:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.REJECT);},afterCommit:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].reject();}},onMetaChange:function(A,B,o){this.recordType=B;this.fields=B.prototype.fields;delete this.snapshot;this.sortInfo=A.sortInfo||this.sortInfo;this.modified=[];this.fireEvent('metachange',this,this.reader.meta);},moveIndex:function(A,B){var C=this.indexOf(A);var D=C+B;this.remove(A);this.insert(D,A);}});
 //Roo/data/SimpleStore.js
 Roo.data.SimpleStore=function(A){Roo.data.SimpleStore.superclass.constructor.call(this,{isLocal:true,reader:new Roo.data.ArrayReader({id:A.id},Roo.data.Record.create(A.fields)),proxy:new Roo.data.MemoryProxy(A.data)});this.load();};Roo.extend(Roo.data.SimpleStore,Roo.data.Store);
index 5ac8f71..22c0d54 100644 (file)
@@ -9527,7 +9527,6 @@ Roo.extend(Roo.data.Store, Roo.util.Observable, {
             }
             value = new RegExp((anyMatch === true ? '' : '^') + Roo.escapeRe(value), "i");
         }
-        
         return function(r){
             return value.test(r.data[property]);
         };
@@ -9559,59 +9558,8 @@ Roo.extend(Roo.data.Store, Roo.util.Observable, {
      * @param {Boolean} anyMatch True to match any part not just the beginning
      */
     filter : function(property, value, anyMatch){
-        
-        if(typeof(property) == 'string'){
-            var fn = this.createFilterFn(property, value, anyMatch);
-            return fn ? this.filterBy(fn) : this.clearFilter();
-        }
-        
-        var fn = [];
-        var afn = [];
-        
-        var _this = this;
-        
-        Roo.each(property, function(p){
-            if(anyMatch == true){
-                afn.push(_this.createFilterFn(p, value, true));
-            }
-            
-            fn.push(_this.createFilterFn(p, value, false));
-        });
-        
-        if(!fn.length && !afn.length){
-            return this.clearFilter();
-        }
-        
-        this.snapshot = this.snapshot || this.data;
-        
-        var filterData = [];
-        
-        Roo.each(fn, function(f){
-            filterData.push(_this.queryBy(f, _this));
-        });
-        
-        Roo.each(afn, function(f){
-            filterData.push(_this.queryBy(f, _this));
-        });
-        
-        var data = this.snapshot || this.data;
-        
-        var r = new Roo.util.MixedCollection();
-        r.getKey = data.getKey;
-        
-        var keys =[];
-        
-        Roo.each(filterData, function(d){
-            var k = d.keys, it = d.items;
-            for(var i = 0, len = it.length; i < len; i++){
-                if(keys.indexOf(k[i]) == -1){
-                    r.add(k[i], it[i]);
-                }
-            }
-        });
-        
-        this.data = r;
-        this.fireEvent("datachanged", this);
+        var fn = this.createFilterFn(property, value, anyMatch);
+        return fn ? this.filterBy(fn) : this.clearFilter();
     },
 
     /**
@@ -10745,7 +10693,6 @@ Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, {
  * @cfg {Boolean} triggerList trigger show the list or not (true|false) default true
  * @cfg {Boolean} showToggleBtn show toggle button or not (true|false) default true
  * @cfg {String} btnPosition set the position of the trigger button (left | right) default right
- * @cfg {Boolean} anyMatch (true|false) any match when filter default false
  * @constructor
  * Create a new ComboBox.
  * @param {Object} config Configuration options
@@ -10810,7 +10757,13 @@ Roo.bootstrap.ComboBox = function(config){
          * Fires when the remove value from the combobox array
             * @param {Roo.bootstrap.ComboBox} combo This combo box
             */
-        'remove' : true
+        'remove' : true,
+        /**
+         * @event specialfilter
+         * Fires when specialfilter
+            * @param {Roo.bootstrap.ComboBox} combo This combo box
+            */
+        'specialfilter' : true
         
     });
     
@@ -10860,11 +10813,6 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
      */
     displayField: undefined,
     
-    /**
-     * @cfg {Array} filterField The filter field name to bind to this CombBox (defaults to undefined if
-     */
-    filterField: undefined,
-    
     /**
      * @cfg {String} valueField The underlying data value name to bind to this CombBox (defaults to undefined if
      * mode = 'remote' or 'value' if mode = 'local'). 
@@ -11011,14 +10959,9 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
     validClass : "has-success",
     
     /**
-     * @cfg {Boolean} filterSort (true|false) sort the filter result default false
-     */
-    filterSort : false,
-    
-    /**
-     * @cfg {String} filterSortDir (ASC|DESC) dir of sort the filter result default ASC
+     * @cfg {Boolean} specialFilter (true|false) special filter default false
      */
-    filterSortDir : 'ASC',
+    specialFilter : false,
     
     //private
     addicon : false,
@@ -11033,7 +10976,6 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
     btnPosition : 'right',
     triggerList : true,
     showToggleBtn : true,
-    anyMatch : false,
     // element that contains real text value.. (when hidden is used..)
     
     getAutoCreate : function()
@@ -12132,12 +12074,14 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
                     if(forceAll){
                         this.store.clearFilter();
                     }else{
-                        this.store.filter(this.filterField || this.displayField, q, this.anyMatch);
                         
-                        if(this.filterSort){
-                            this.store.data.sort(this.displayField, this.filterSortDir);
+                        if(this.specialFilter){
+                            this.fireEvent('specialfilter', this);
+                            this.onLoad();
+                            return;
                         }
                         
+                        this.store.filter(this.displayField, q);
                     }
                     this.onLoad();
                 }else{
@@ -12168,7 +12112,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
         
         this.loadNext = false;
     },
-
+    
     // private
     getParams : function(q){
         var p = {};
index 5f8e9d1..74a6e90 100644 (file)
@@ -206,9 +206,7 @@ this.fireEvent("loadexception",this,o,A,o.raw.errorMsg);return;}var r=o.records,
 this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else {this.totalLength=Math.max(t,this.data.length+r.length);this.add(r);}
 this.fireEvent("load",this,r,A,o);if(A.callback){A.callback.call(A.scope||this,r,A,true);}},loadData:function(o,A){var r=this.reader.readRecords(o);this.loadRecords(r,{add:A},true);},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;},getSortState:function(){return this.sortInfo;},applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);};this.data.sort(s.direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(s.direction,fn);}}},setDefaultSort:function(A,B){this.sortInfo={field:A,direction:B?B.toUpperCase():"ASC"};},sort:function(A,B){var f=this.fields.get(A);if(!B){this.sortToggle[f.name]=this.sortToggle[f.name]||f.sortDir;if(this.multiSort||(this.sortInfo&&this.sortInfo.field==f.name)){B=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");}else {B=f.sortDir;}}
 this.sortToggle[f.name]=B;this.sortInfo={field:f.name,direction:B};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else {this.load(this.lastOptions);}},each:function(fn,A){this.data.each(fn,A);},getModifiedRecords:function(){return this.modified;},createFilterFn:function(A,B,C){if(!B.exec){B=String(B);if(B.length==0){return false;}
-B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){if(typeof(A)=='string'){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();}var fn=[];var D=[];var E=this;Roo.each(A,function(p){if(C==true){D.push(E.createFilterFn(p,B,true));}
-fn.push(E.createFilterFn(p,B,false));});if(!fn.length&&!D.length){return this.clearFilter();}
-this.snapshot=this.snapshot||this.data;var F=[];Roo.each(fn,function(f){F.push(E.queryBy(f,E));});Roo.each(D,function(f){F.push(E.queryBy(f,E));});var G=this.snapshot||this.data;var r=new Roo.util.MixedCollection();r.getKey=G.getKey;var H=[];Roo.each(F,function(d){var k=d.keys,it=d.items;for(var i=0,I=it.length;i<I;i++){if(H.indexOf(k[i])==-1){r.add(k[i],it[i]);}}});this.data=r;this.fireEvent("datachanged",this);},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
+B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
 this.fireEvent("update",this,A,Roo.data.Record.EDIT);},afterReject:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.REJECT);},afterCommit:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].reject();}},onMetaChange:function(A,B,o){this.recordType=B;this.fields=B.prototype.fields;delete this.snapshot;this.sortInfo=A.sortInfo||this.sortInfo;this.modified=[];this.fireEvent('metachange',this,this.reader.meta);},moveIndex:function(A,B){var C=this.indexOf(A);var D=C+B;this.remove(A);this.insert(D,A);}});
 //Roo/data/SimpleStore.js
 Roo.data.SimpleStore=function(A){Roo.data.SimpleStore.superclass.constructor.call(this,{isLocal:true,reader:new Roo.data.ArrayReader({id:A.id},Roo.data.Record.create(A.fields)),proxy:new Roo.data.MemoryProxy(A.data)});this.load();};Roo.extend(Roo.data.SimpleStore,Roo.data.Store);
@@ -242,7 +240,7 @@ G[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var H=new A(G,id);H.json=
 //Roo/data/ArrayReader.js
 Roo.data.ArrayReader=function(A,B){Roo.data.ArrayReader.superclass.constructor.call(this,A,B);};Roo.extend(Roo.data.ArrayReader,Roo.data.JsonReader,{readRecords:function(o){var A=this.meta?this.meta.id:null;var B=this.recordType,C=B.prototype.fields;var D=[];var E=o;for(var i=0;i<E.length;i++){var n=E[i];var F={};var id=((A||A===0)&&n[A]!==undefined&&n[A]!==""?n[A]:null);for(var j=0,G=C.length;j<G;j++){var f=C.items[j];var k=f.mapping!==undefined&&f.mapping!==null?f.mapping:j;var v=n[k]!==undefined?n[k]:f.defaultValue;v=f.convert(v);F[f.name]=v;}var H=new B(F,id);H.json=n;D[D.length]=H;}return {records:D,totalRecords:D.length};}});
 //Roo/bootstrap/ComboBox.js
-Roo.bootstrap.ComboBox=function(A){Roo.bootstrap.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true,'remove':true});this.item=[];this.tickItems=[];this.selectedIndex=-1;if(this.mode=='local'){if(A.queryDelay===undefined){this.queryDelay=10;}if(A.minChars===undefined){this.minChars=0;}}};Roo.extend(Roo.bootstrap.ComboBox,Roo.bootstrap.TriggerField,{listWidth:undefined,displayField:undefined,filterField:undefined,valueField:undefined,hiddenName:undefined,listClass:'',selectedClass:'active',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,blockFocus:false,disableClear:false,alwaysQuery:false,multiple:false,invalidClass:"has-warning",validClass:"has-success",filterSort:false,filterSortDir:'ASC',addicon:false,editicon:false,page:0,hasQuery:false,append:false,loadNext:false,autoFocus:true,tickable:false,btnPosition:'right',triggerList:true,showToggleBtn:true,anyMatch:false,getAutoCreate:function(){var A=false;if(!this.tickable){A=Roo.bootstrap.ComboBox.superclass.getAutoCreate.call(this);return A;}var B=this.labelAlign||this.parentLabelAlign();A={cls:'form-group roo-combobox-tickable'};var C={tag:'div',cls:'tickable-buttons',cn:[{tag:'button',type:'button',cls:'btn btn-link btn-edit pull-'+this.btnPosition,html:'Edit'},{tag:'button',type:'button',name:'ok',cls:'btn btn-link btn-ok pull-'+this.btnPosition,html:'Done'},{tag:'button',type:'button',name:'cancel',cls:'btn btn-link btn-cancel pull-'+this.btnPosition,html:'Cancel'}]};if(this.editable){C.cn.unshift({tag:'input',cls:'select2-search-field-input'});}var D=this;Roo.each(C.cn,function(c){if(D.size){c.cls+=' btn-'+D.size;}if(D.disabled){c.disabled=true;}});var E={tag:'div',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'},{tag:'ul',cls:'select2-choices',cn:[{tag:'li',cls:'select2-search-field',cn:[C]}]}]};var combobox={cls:'select2-container input-group select2-container-multi',cn:[E]};if(this.hasFeedback&&!this.allowBlank){var F={tag:'span',cls:'glyphicon form-control-feedback'};combobox.cn.push(F);}if(B==='left'&&this.fieldLabel.length){Roo.log("left and has label");A.cn=[{tag:'label','for':id,cls:'control-label col-sm-'+this.labelWidth,html:this.fieldLabel},{cls:"col-sm-"+(12-this.labelWidth),cn:[combobox]}];}else if(this.fieldLabel.length){Roo.log(" label");A.cn=[{tag:'label',html:this.fieldLabel},combobox];}else {Roo.log(" no label && no align");A=combobox}var G=this;['xs','sm','md','lg'].map(function(H){if(G[H]){A.cls+=' col-'+H+'-'+G[H];}});return A;},initEvents:function(){if(!this.store){throw "can not find store for combo";}
+Roo.bootstrap.ComboBox=function(A){Roo.bootstrap.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true,'remove':true,'specialfilter':true});this.item=[];this.tickItems=[];this.selectedIndex=-1;if(this.mode=='local'){if(A.queryDelay===undefined){this.queryDelay=10;}if(A.minChars===undefined){this.minChars=0;}}};Roo.extend(Roo.bootstrap.ComboBox,Roo.bootstrap.TriggerField,{listWidth:undefined,displayField:undefined,valueField:undefined,hiddenName:undefined,listClass:'',selectedClass:'active',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,blockFocus:false,disableClear:false,alwaysQuery:false,multiple:false,invalidClass:"has-warning",validClass:"has-success",specialFilter:false,addicon:false,editicon:false,page:0,hasQuery:false,append:false,loadNext:false,autoFocus:true,tickable:false,btnPosition:'right',triggerList:true,showToggleBtn:true,getAutoCreate:function(){var A=false;if(!this.tickable){A=Roo.bootstrap.ComboBox.superclass.getAutoCreate.call(this);return A;}var B=this.labelAlign||this.parentLabelAlign();A={cls:'form-group roo-combobox-tickable'};var C={tag:'div',cls:'tickable-buttons',cn:[{tag:'button',type:'button',cls:'btn btn-link btn-edit pull-'+this.btnPosition,html:'Edit'},{tag:'button',type:'button',name:'ok',cls:'btn btn-link btn-ok pull-'+this.btnPosition,html:'Done'},{tag:'button',type:'button',name:'cancel',cls:'btn btn-link btn-cancel pull-'+this.btnPosition,html:'Cancel'}]};if(this.editable){C.cn.unshift({tag:'input',cls:'select2-search-field-input'});}var D=this;Roo.each(C.cn,function(c){if(D.size){c.cls+=' btn-'+D.size;}if(D.disabled){c.disabled=true;}});var E={tag:'div',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'},{tag:'ul',cls:'select2-choices',cn:[{tag:'li',cls:'select2-search-field',cn:[C]}]}]};var combobox={cls:'select2-container input-group select2-container-multi',cn:[E]};if(this.hasFeedback&&!this.allowBlank){var F={tag:'span',cls:'glyphicon form-control-feedback'};combobox.cn.push(F);}if(B==='left'&&this.fieldLabel.length){Roo.log("left and has label");A.cn=[{tag:'label','for':id,cls:'control-label col-sm-'+this.labelWidth,html:this.fieldLabel},{cls:"col-sm-"+(12-this.labelWidth),cn:[combobox]}];}else if(this.fieldLabel.length){Roo.log(" label");A.cn=[{tag:'label',html:this.fieldLabel},combobox];}else {Roo.log(" no label && no align");A=combobox}var G=this;['xs','sm','md','lg'].map(function(H){if(G[H]){A.cls+=' col-'+H+'-'+G[H];}});return A;},initEvents:function(){if(!this.store){throw "can not find store for combo";}
 this.store=Roo.factory(this.store,Roo.data);if(this.tickable){this.initTickableEvents();return;}
 Roo.bootstrap.ComboBox.superclass.initEvents.call(this);if(this.hiddenName){this.hiddenField=this.el.select('input.form-hidden-field',true).first();this.hiddenField.dom.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');this.hiddenField.dom.setAttribute('name',this.hiddenName);}var A='x-combo-list';var B=this;(function(){var lw=B.listWidth||Math.max(B.inputEl().getWidth(),B.minListWidth);B.list.setWidth(lw);}).defer(100);this.list.on('mouseover',this.onViewOver,this);this.list.on('mousemove',this.onViewMove,this);this.list.on('scroll',this.onViewScroll,this);if(!this.tpl){this.tpl='<li><a href="#">{'+this.displayField+'}</a></li>';}
 this.view=new Roo.View(this.list,this.tpl,{singleSelect:true,store:this.store,selectedClass:this.selectedClass});this.view.on('click',this.onViewClick,this);this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoadException,this);if(!this.editable){this.editable=true;this.setEditable(false);}
@@ -264,7 +262,8 @@ rm=true;return;}});if(rm){return;}
 this.tickItems.push(r.data);if(typeof(e)=='undefined'&&A==false){Roo.get(D.view.getNodes(C,C)[0]).select('input',true).first().dom.checked=true;}return;}if(r){this.onSelect(r,C);}if(B!==false&&!this.blockFocus){this.inputEl().focus();}},restrictHeight:function(){this.list.alignTo(this.inputEl(),this.listAlign);this.list.alignTo(this.inputEl(),this.listAlign);},onEmptyResults:function(){if(this.tickable&&this.editable){this.restrictHeight();return;}
 this.collapse();},isExpanded:function(){return this.list.isVisible();},selectByValue:function(v,A){if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),A);return true;}}return false;},select:function(A,B){this.selectedIndex=A;this.view.select(A);if(B!==false){var el=this.view.getNode(A);if(el){this.list.scrollChildIntoView(el,false);}}},selectNext:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex<ct-1){this.select(this.selectedIndex+1);}}},selectPrev:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex!=0){this.select(this.selectedIndex-1);}}},onKeyUp:function(e){if(this.editable!==false&&!e.isSpecialKey()){this.lastKey=e.getKey();this.dqTask.delay(this.queryDelay);}},validateBlur:function(){return !this.list||!this.list.isVisible();},initQuery:function(){var v=this.getRawValue();if(this.tickable&&this.editable){v=this.tickableInputEl().getValue();}
 this.doQuery(v);},doForce:function(){if(this.inputEl().dom.value.length>0){this.inputEl().dom.value=this.lastSelectionText===undefined?'':this.lastSelectionText;}},doQuery:function(q,A){if(q===undefined||q===null){q='';}var qe={query:q,forceAll:A,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
-q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){this.hasQuery=true;if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(A){this.store.clearFilter();}else {this.store.filter(this.filterField||this.displayField,q,this.anyMatch);if(this.filterSort){this.store.data.sort(this.displayField,this.filterSortDir);}}
+q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){this.hasQuery=true;if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(A){this.store.clearFilter();}else {if(this.specialFilter){this.fireEvent('specialfilter',this);this.onLoad();return;}
+this.store.filter(this.displayField,q);}
 this.onLoad();}else {this.store.baseParams[this.queryParam]=q;var B={params:this.getParams(q)};if(this.loadNext){B.add=true;B.params.start=this.page*this.pageSize;}
 this.store.load(B);}}else {this.selectedIndex=-1;this.onLoad();}}
 this.loadNext=false;},getParams:function(q){var p={};if(this.pageSize){p.start=0;p.limit=this.pageSize;}return p;},collapse:function(){if(!this.isExpanded()){return;}
index 1887634..f56e40e 100644 (file)
@@ -21699,7 +21699,6 @@ Roo.extend(Roo.data.Store, Roo.util.Observable, {
             }
             value = new RegExp((anyMatch === true ? '' : '^') + Roo.escapeRe(value), "i");
         }
-        
         return function(r){
             return value.test(r.data[property]);
         };
@@ -21731,59 +21730,8 @@ Roo.extend(Roo.data.Store, Roo.util.Observable, {
      * @param {Boolean} anyMatch True to match any part not just the beginning
      */
     filter : function(property, value, anyMatch){
-        
-        if(typeof(property) == 'string'){
-            var fn = this.createFilterFn(property, value, anyMatch);
-            return fn ? this.filterBy(fn) : this.clearFilter();
-        }
-        
-        var fn = [];
-        var afn = [];
-        
-        var _this = this;
-        
-        Roo.each(property, function(p){
-            if(anyMatch == true){
-                afn.push(_this.createFilterFn(p, value, true));
-            }
-            
-            fn.push(_this.createFilterFn(p, value, false));
-        });
-        
-        if(!fn.length && !afn.length){
-            return this.clearFilter();
-        }
-        
-        this.snapshot = this.snapshot || this.data;
-        
-        var filterData = [];
-        
-        Roo.each(fn, function(f){
-            filterData.push(_this.queryBy(f, _this));
-        });
-        
-        Roo.each(afn, function(f){
-            filterData.push(_this.queryBy(f, _this));
-        });
-        
-        var data = this.snapshot || this.data;
-        
-        var r = new Roo.util.MixedCollection();
-        r.getKey = data.getKey;
-        
-        var keys =[];
-        
-        Roo.each(filterData, function(d){
-            var k = d.keys, it = d.items;
-            for(var i = 0, len = it.length; i < len; i++){
-                if(keys.indexOf(k[i]) == -1){
-                    r.add(k[i], it[i]);
-                }
-            }
-        });
-        
-        this.data = r;
-        this.fireEvent("datachanged", this);
+        var fn = this.createFilterFn(property, value, anyMatch);
+        return fn ? this.filterBy(fn) : this.clearFilter();
     },
 
     /**
index 7e2b7e2..9efecf4 100644 (file)
@@ -5259,7 +5259,6 @@ Roo.extend(Roo.data.Store, Roo.util.Observable, {
             }
             value = new RegExp((anyMatch === true ? '' : '^') + Roo.escapeRe(value), "i");
         }
-        
         return function(r){
             return value.test(r.data[property]);
         };
@@ -5291,59 +5290,8 @@ Roo.extend(Roo.data.Store, Roo.util.Observable, {
      * @param {Boolean} anyMatch True to match any part not just the beginning
      */
     filter : function(property, value, anyMatch){
-        
-        if(typeof(property) == 'string'){
-            var fn = this.createFilterFn(property, value, anyMatch);
-            return fn ? this.filterBy(fn) : this.clearFilter();
-        }
-        
-        var fn = [];
-        var afn = [];
-        
-        var _this = this;
-        
-        Roo.each(property, function(p){
-            if(anyMatch == true){
-                afn.push(_this.createFilterFn(p, value, true));
-            }
-            
-            fn.push(_this.createFilterFn(p, value, false));
-        });
-        
-        if(!fn.length && !afn.length){
-            return this.clearFilter();
-        }
-        
-        this.snapshot = this.snapshot || this.data;
-        
-        var filterData = [];
-        
-        Roo.each(fn, function(f){
-            filterData.push(_this.queryBy(f, _this));
-        });
-        
-        Roo.each(afn, function(f){
-            filterData.push(_this.queryBy(f, _this));
-        });
-        
-        var data = this.snapshot || this.data;
-        
-        var r = new Roo.util.MixedCollection();
-        r.getKey = data.getKey;
-        
-        var keys =[];
-        
-        Roo.each(filterData, function(d){
-            var k = d.keys, it = d.items;
-            for(var i = 0, len = it.length; i < len; i++){
-                if(keys.indexOf(k[i]) == -1){
-                    r.add(k[i], it[i]);
-                }
-            }
-        });
-        
-        this.data = r;
-        this.fireEvent("datachanged", this);
+        var fn = this.createFilterFn(property, value, anyMatch);
+        return fn ? this.filterBy(fn) : this.clearFilter();
     },
 
     /**
index 656a00b..251ba1f 100644 (file)
@@ -92,9 +92,7 @@ this.fireEvent("loadexception",this,o,A,o.raw.errorMsg);return;}var r=o.records,
 this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else {this.totalLength=Math.max(t,this.data.length+r.length);this.add(r);}
 this.fireEvent("load",this,r,A,o);if(A.callback){A.callback.call(A.scope||this,r,A,true);}},loadData:function(o,A){var r=this.reader.readRecords(o);this.loadRecords(r,{add:A},true);},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;},getSortState:function(){return this.sortInfo;},applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);};this.data.sort(s.direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(s.direction,fn);}}},setDefaultSort:function(A,B){this.sortInfo={field:A,direction:B?B.toUpperCase():"ASC"};},sort:function(A,B){var f=this.fields.get(A);if(!B){this.sortToggle[f.name]=this.sortToggle[f.name]||f.sortDir;if(this.multiSort||(this.sortInfo&&this.sortInfo.field==f.name)){B=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");}else {B=f.sortDir;}}
 this.sortToggle[f.name]=B;this.sortInfo={field:f.name,direction:B};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else {this.load(this.lastOptions);}},each:function(fn,A){this.data.each(fn,A);},getModifiedRecords:function(){return this.modified;},createFilterFn:function(A,B,C){if(!B.exec){B=String(B);if(B.length==0){return false;}
-B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){if(typeof(A)=='string'){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();}var fn=[];var D=[];var E=this;Roo.each(A,function(p){if(C==true){D.push(E.createFilterFn(p,B,true));}
-fn.push(E.createFilterFn(p,B,false));});if(!fn.length&&!D.length){return this.clearFilter();}
-this.snapshot=this.snapshot||this.data;var F=[];Roo.each(fn,function(f){F.push(E.queryBy(f,E));});Roo.each(D,function(f){F.push(E.queryBy(f,E));});var G=this.snapshot||this.data;var r=new Roo.util.MixedCollection();r.getKey=G.getKey;var H=[];Roo.each(F,function(d){var k=d.keys,it=d.items;for(var i=0,I=it.length;i<I;i++){if(H.indexOf(k[i])==-1){r.add(k[i],it[i]);}}});this.data=r;this.fireEvent("datachanged",this);},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
+B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
 this.fireEvent("update",this,A,Roo.data.Record.EDIT);},afterReject:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.REJECT);},afterCommit:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].reject();}},onMetaChange:function(A,B,o){this.recordType=B;this.fields=B.prototype.fields;delete this.snapshot;this.sortInfo=A.sortInfo||this.sortInfo;this.modified=[];this.fireEvent('metachange',this,this.reader.meta);},moveIndex:function(A,B){var C=this.indexOf(A);var D=C+B;this.remove(A);this.insert(D,A);}});
 //Roo/data/SimpleStore.js
 Roo.data.SimpleStore=function(A){Roo.data.SimpleStore.superclass.constructor.call(this,{isLocal:true,reader:new Roo.data.ArrayReader({id:A.id},Roo.data.Record.create(A.fields)),proxy:new Roo.data.MemoryProxy(A.data)});this.load();};Roo.extend(Roo.data.SimpleStore,Roo.data.Store);