日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

extjs combobox分页查询

發布時間:2024/10/12 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 extjs combobox分页查询 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

IE6.0++

extjs3.3.1

以下就是代碼:

/** * YHC */ /** * 分頁的Combobox */ PagingMedicalcareCbo=Ext.extend(Ext.form.ComboBox,{ /** * 構造方法 */ timedelay_Slow:2000,//1000ms=1s timedelay_fast:1000,//1000ms=1s t:null, myStore:null, currentCboText:null,//當前CBO文本框中的值 constructor:function(){ this.myStore=new Ext.data.JsonStore({ url:"/his/medical_care!ajaxMedicalcareCbo.action",//url地址 root: 'root', idProperty: 'linkId', totalProperty:"totalProperty", fields:[{name:"linkId"}, {name:"orgCode"}, {name:"orgName"}, {name:"dbName"}, {name:"serverType"}], listeners :{ beforeload:this.onCboBeforeLoad, scope:this } }); // PagingMedicalcareCbo.superclass.constructor.call(this,{ id:"searchCbo", store:this.myStore, mode:"remote", pageSize:5, triggerAction:"all", displayField:"orgName", //valueField:"linkId", width:180, listWidth:220, fieldLabel:'醫療單位', listeners :{ select:this.onSelected, keyup:this.onKeyup, scope:this } }); }, //設置參數 onCboBeforeLoad:function(store,options){ if(this.currentCboText!=null&&(typeof this.currentCboText)!='undefined'){ //帶機構名稱 store.baseParams={'medicalCareVo.orgName':this.currentCboText}; }else{ //沒有任何的參數 store.baseParams={}; } }, //選擇之后,對應賦值 onSelected:function(combo,record,index){ var orgName=this.myStore.getAt(index).get('orgName'); //this.value=orgName; alert(this.myStore.getAt(index).get('orgName')); }, //鍵盤彈起的時候 ,賦值當前文本值 onKeyup:function(combo,e){ this.currentCboText=Ext.getCmp('searchCbo').getValue(); //切記 清除(很重要) 下一次需要清除上一次 if(this.t){ window.clearInterval(this.t);//清除延時執行 } //如果此時用戶將文本框的值刪除完之后(也就是沒有任何的值) if(this.currentCboText==''){ this.t=window.setInterval('Ext.getCmp("searchCbo").myStoreLoadData()', this.timedelay_fast); return; } //延時執行,避免用戶輸入太快,導致訪問服務器次數增加,節約性能 this.t=window.setInterval('Ext.getCmp("searchCbo").myStoreLoadData()', this.timedelay_Slow); }, //--myStore重新加載數據 myStoreLoadData:function(){ //重新加載數據 this.myStore.load({ params:{start:0,limit:5} }); //切記 清除(很重要) if(this.t!=null){ window.clearInterval(this.t);//清除延時執行 } } });

在調用延時的時候需要使用字符串調用:

this.t=window.setInterval('Ext.getCmp("searchCbo").myStoreLoadData()', this.timedelay_Slow);還有切記使用Ext的方法,不能使用this.方法名(錯誤),正確的是我上面寫的方式.

在調用的時候需要使用字符串,才能延時調用,否則不可以,切記切記....


轉載于:https://www.cnblogs.com/hibernate3-example/archive/2012/04/18/2492388.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的extjs combobox分页查询的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。