1.使用simplestore正常
2.使用远程数据,设置triggerAction:'all',正常
3.使用远程数据,设置triggerAction:'query',读不出数据
4.使用远程数据,设置triggerAction:'query',在combobox中输入4个字符可加载到数据,但没有筛选功能
[code="java"]
var employee_store = new Ext.data.Store({
proxy:new Ext.data.HttpProxy({url:"../Process/Form_cli_e.ashx"}),
reader: new Ext.data.JsonReader({
//remote:true,
totalProperty:'totalProperty',
root:'root',
id:'employee_store'
},[
{name: 'ry_name'},
{name: 'ry_gh'}
])
});
function cli_e(){
var cli_e_box = new Ext.form.ComboBox({
mode:'remote',
idname:'cli_E',
name:'cli_E',
displayField:'ry_name',
valueField:'ry_gh',
store:employee_store,
typeAhead:false,
triggerAction:'query'
});
return cli_e_box;
}
[/code]
EXT combbox 下拉问题
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- suziwen 2010-03-19 09:33关注
combo.js
[code="js"]Ext.ns('Example');Example.comboConfig = {
xtype:'combo'// we need id to focus this field. See window::defaultButton ,id:'combo' // we want to submit id, not text ,valueField:'persID' ,hiddenName:'persID' // could be undefined as we use custom template ,displayField:'persLastName' // query all records on trigger click ,triggerAction:'all' // minimum characters to start the search ,minChars:2 // do not allow arbitrary values ,forceSelection:true // otherwise we will not receive key events ,enableKeyEvents:true // let's use paging combo ,pageSize:5 // make the drop down list resizable ,resizable:true // we need wider list for paging toolbar ,minListWidth:220 // force user to fill something ,allowBlank:false // store getting items from server ,store:new Ext.data.JsonStore({ id:'persID' ,root:'rows' ,totalProperty:'totalCount' ,fields:[ {name:'persID', type:'int'} ,{name:'persLastName', type:'string'} ,{name:'persFirstName', type:'string'} ] ,url:'process-request.php' ,baseParams:{ cmd:'getData' ,objName:'person2' ,fields:'["persLastName","persFirstName"]' } }) // concatenate last and first names ,tpl:'<tpl for="."><div class="x-combo-list-item">{persLastName}, {persFirstName}</div></tpl>' // listeners ,listeners:{ // sets raw value to concatenated last and first names select:function(combo, record, index) { this.setRawValue(record.get('persLastName') + ', ' + record.get('persFirstName')); } // repair raw value after blur ,blur:function() { var val = this.getRawValue(); this.setRawValue.defer(1, this, [val]); } // set tooltip and validate ,render:function() { this.el.set( {qtip:'Type at least ' + this.minChars + ' characters to search in last name'} ); this.validate(); } // requery if field is cleared by typing ,keypress:{buffer:100, fn:function() { if(!this.getRawValue()) { this.doQuery('', true); } }} } // label ,fieldLabel:'Combo'
};
// main entry point
Ext.onReady(function() {
Ext.QuickTips.init();// invalid markers to sides Ext.form.Field.prototype.msgTarget = 'side'; // create and show window var win = new Ext.Window({ id:'combo-win' ,title:Ext.fly('page-title').dom.innerHTML ,layout:'fit' ,width:300 ,height:150 ,closable:false ,border:false // let window code to focus the combo on show ,defaultButton:'combo' ,items:{ xtype:'form' ,frame:true ,defaults:{anchor:'-20'} ,items:[{ xtype:'textfield' ,fieldLabel:'Dummy Field' } ,Example.comboConfig ] } }); win.show();
}); // eo onReady
[/code]combo.html:
[code="html"]
Combo with Remote Store by Saki
<!--<br> google_ad_client = "pub-2768521146228687";<br> /* 728x90, for examples ifram */<br> google_ad_slot = "5477402227";<br> google_ad_width = 728;<br> google_ad_height = 90;<br> //--><br>
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><br>
<?if("examples.extjs.eu"===$_SERVER["SERVER_NAME"]){$page='combo';include("stats.php");}?>
[/code]本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 保护模式-系统加载-段寄存器