ExtJS ComboBox之 键入自动查询

Ext.create('Ext.form.Panel', {
title: '菜单编辑',
id:'editMenuForm',
bodyPadding: 5,
// The form will submit an AJAX request to this URL when submitted
url: '/SystemManage/SaveMenuForm',
method: 'POST',
// Fields will be arranged vertically, stretched to full width
layout: 'anchor',
defaults: {
anchor: '100%'
},
// The fields
defaultType: 'textfield',
items: [{
name: 'menuGuid',
id:'menuGuid',
xtype:'hiddenfield'
},{
fieldLabel: '菜单名称',
name: 'menuName',
id:'menuName',
allowBlank: false
}, {
fieldLabel: '菜单地址',
id:'menuUrl',
name: 'menuUrl',
// allowBlank: false
}, {
id: 'remark1',
name: 'remark1',
fieldLabel: '排序ASC',
allowBlank: false
},{
id:'menuList',
name: 'menuList',
xtype: 'combo',
allowBlank: false,
fieldLabel: '父菜单',
labelSeparator: ':',
multiSelect: false,
valueField: 'sm_guid', //'dictdataCode', 
displayField: 'sm_name', //'dictdataName', 
store: comboStore,
//typeAhead : true, 
mode: 'local', // default: remote 
triggerAction: 'all',
emptyText: '请选择父菜单',
readOnly: false,
editable : true, 
selectOnFocus :true,
anchor: '50%',
minChars : 1, 
queryParam :'sm_name'
},{
id: 'remark2',
name: 'remark2',
fieldLabel: '最高管理员可见',
anchor: '40%',
allowBlank: false
}],
buttonAlign:"left",
buttons: [{
text: '新增',
id:"btnSumbit",
formBind: true, //only enabled once the form is valid
disabled: true,
handler: function () {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
success: function (form, action) {
Ext.Msg.alert('提示','操作成功!');
menuStore.reload();
},
failure: function (form, action) {
Ext.Msg.alert('提示', '操作失败!' + action.result.message);
ReturnFailJsonResult(action.result);
}
});
}
}
},{
text: '重置',
handler: function () {
this.up('form').getForm().reset();
Ext.getCmp('btnSumbit').setText("新增");
}
}],
renderTo: "gridForm"
});

关键点:

1.minChars:如果没有为该属性赋值,则默认是4,即在输入4个字符时,才会触发自动完成(即动态查询) 
2.forceSelection:只能从下拉框中任选一个值,如果输入的值不存在下拉框中,将会被自动清空。 
3.queryParam:当在输入框输入1个字符时,将会把“sm_name=输入值”传递到服务端。  
4.hideTrigge:这个属性当为true时,会隐藏掉combobox的下拉按钮。

5.forceSelection:ExtJs默认是选框内输入值不验证是否在 列表中,  加此属性 会在列表中限制用户输入 列表以外的值

转载于:https://www.cnblogs.com/bivozeou/p/4011112.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值