support listClass for bootstrap combobox
authorleon <leon@roojs.com>
Tue, 7 Nov 2023 05:57:34 +0000 (13:57 +0800)
committerleon <leon@roojs.com>
Tue, 7 Nov 2023 05:57:34 +0000 (13:57 +0800)
Roo/bootstrap/form/ComboBox.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 7b9b462..97a62cb 100644 (file)
@@ -195,7 +195,7 @@ Roo.extend(Roo.bootstrap.form.ComboBox, Roo.bootstrap.form.TriggerField, {
     /**
      * @cfg {Number} maxHeight The maximum height in pixels of the dropdown list before scrollbars are shown (defaults to 300)
      */
-    maxHeight: 300,
+    // maxHeight: 300, // not used (change maxHeight in CSS. target the list using listClass)
     /**
      * @cfg {String} triggerAction The action to execute when the trigger field is activated.  Use 'all' to run the
      * query specified by the allQuery config option (defaults to 'query')
@@ -720,6 +720,8 @@ Roo.extend(Roo.bootstrap.form.ComboBox, Roo.bootstrap.form.TriggerField, {
         //this.list = new Roo.Layer({
         //    shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
         //});
+
+        this.list.addClass(this.listClass);
         
         var _this = this;
         
index 3829e7e..117b541 100644 (file)
@@ -17075,7 +17075,7 @@ Roo.extend(Roo.bootstrap.form.ComboBox, Roo.bootstrap.form.TriggerField, {
     /**
      * @cfg {Number} maxHeight The maximum height in pixels of the dropdown list before scrollbars are shown (defaults to 300)
      */
-    maxHeight: 300,
+    // maxHeight: 300, // not used (change maxHeight in CSS. target the list using listClass)
     /**
      * @cfg {String} triggerAction The action to execute when the trigger field is activated.  Use 'all' to run the
      * query specified by the allQuery config option (defaults to 'query')
@@ -17600,6 +17600,8 @@ Roo.extend(Roo.bootstrap.form.ComboBox, Roo.bootstrap.form.TriggerField, {
         //this.list = new Roo.Layer({
         //    shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
         //});
+
+        this.list.addClass(this.listClass);
         
         var _this = this;
         
index e7340c5..1f6c5fd 100644 (file)
@@ -713,7 +713,7 @@ var D=[];var E=o;for(var i=0;i<E.length;i++){var n=E[i];var F={};var id=((A||A==
 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};},toLoadData:function(A){return typeof(A.data.cn)=='undefined'?[]:A.data.cn;}});
 // Roo/bootstrap/form/ComboBox.js
 Roo.bootstrap.form.ComboBox=function(A){Roo.bootstrap.form.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true,'remove':true,'afterremove':true,'specialfilter':true,'tick':true,'touchviewdisplay':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.form.ComboBox,Roo.bootstrap.form.TriggerField,{listWidth:undefined,displayField:undefined,valueField:undefined,modalTitle:'',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,mobileTouchView:true,useNativeIOS:false,mobile_restrict_height:false,ios_options:false,addicon:false,editicon:false,page:0,hasQuery:false,append:false,loadNext:false,autoFocus:true,tickable:false,btnPosition:'right',triggerList:true,showToggleBtn:true,animate:true,emptyResultText:'Empty',triggerText:'Select',emptyTitle:'',width:false,getAutoCreate:function(){var A=false;
+);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.form.ComboBox,Roo.bootstrap.form.TriggerField,{listWidth:undefined,displayField:undefined,valueField:undefined,modalTitle:'',hiddenName:undefined,listClass:'',selectedClass:'active',shadow:'sides',listAlign:'tl-bl?',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,mobileTouchView:true,useNativeIOS:false,mobile_restrict_height:false,ios_options:false,addicon:false,editicon:false,page:0,hasQuery:false,append:false,loadNext:false,autoFocus:true,tickable:false,btnPosition:'right',triggerList:true,showToggleBtn:true,animate:true,emptyResultText:'Empty',triggerText:'Select',emptyTitle:'',width:false,getAutoCreate:function(){var A=false;
 if(Roo.isIOS&&this.useNativeIOS){A=this.getAutoCreateNativeIOS();return A;}if(Roo.isTouch&&this.mobileTouchView){A=this.getAutoCreateTouchView();return A;;}if(!this.tickable){A=Roo.bootstrap.form.ComboBox.superclass.getAutoCreate.call(this);return A;}var B=this.labelAlign||this.parentLabelAlign();
 A={cls:'form-group roo-combobox-tickable'};var C='';var D='';var E='';if(this.btn_text_show){C='Select';D='Done';E='Cancel';}var F={tag:'div',cls:'tickable-buttons',cn:[{tag:'button',type:'button',cls:'btn btn-link btn-edit pull-'+this.btnPosition,html:C}
 ,{tag:'button',type:'button',name:'ok',cls:'btn btn-link btn-ok pull-'+this.btnPosition,html:D},{tag:'button',type:'button',name:'cancel',cls:'btn btn-link btn-cancel pull-'+this.btnPosition,html:E}]};if(this.editable){F.cn.unshift({tag:'input',cls:'roo-select2-search-field-input'}
@@ -727,8 +727,8 @@ M.cls+=' col-md-'+(12-this.labelmd);}if(this.labelsm>0){L.cls+=' col-sm-'+this.l
 }this._initEventsCalled=true;if(!this.store){throw "can not find store for combo";}this.indicator=this.indicatorEl();this.store=Roo.factory(this.store,Roo.data);this.store.parent=this;if(Roo.XComponent.build_from_html){var e=this.el.dom,k=0;while(e){e=e.previousSibling;
 ++k;}this.el.remove();this.el=false;this.rendered=false;this.render(this.parent().getChildContainer(true),k);}if(Roo.isIOS&&this.useNativeIOS){this.initIOSView();return;}if(Roo.isTouch&&this.mobileTouchView){this.initTouchView();return;}if(this.tickable){this.initTickableEvents();
 return;}Roo.bootstrap.form.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=Roo.bootstrap.version==4?'<a class="dropdown-item" href="#">{'+this.displayField+'}</a>':'<li><a class="dropdown-item" href="#">{'+this.displayField+'}</a></li>';
+this.el.dom.removeAttribute('name');this.hiddenField.dom.setAttribute('name',this.hiddenName);}var A='x-combo-list';this.list.addClass(this.listClass);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=Roo.bootstrap.version==4?'<a class="dropdown-item" href="#">{'+this.displayField+'}</a>':'<li><a class="dropdown-item" 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);}this.keyNav=new Roo.KeyNav(this.inputEl(),{"up":function(e){this.inKeyMode=true;this.selectPrev();},"down":function(e){if(!this.isExpanded()){this.onTriggerClick();}else{this.inKeyMode=true;this.selectNext();
 }},"enter":function(e){this.collapse();if(this.fireEvent("specialkey",this,e)){this.onViewClick(false);}return true;},"esc":function(e){this.collapse();},"tab":function(e){this.collapse();if(this.fireEvent("specialkey",this,e)){this.onViewClick(false);}return true;