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 关于#java#的问题:找一份能快速看完mooc视频的代码
- ¥15 这种微信登录授权 谁可以做啊
- ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
- ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
- ¥15 网络设备配置与管理这个该怎么弄
- ¥20 机器学习能否像多层线性模型一样处理嵌套数据
- ¥20 西门子S7-Graph,S7-300,梯形图
- ¥50 用易语言http 访问不了网页
- ¥50 safari浏览器fetch提交数据后数据丢失问题