ExtJS Combobox 如何设置默认和取值问题
2015-09-21 18:48
567 查看
学习ExtJs,如何给combobox选中某一行, 取值问题。
///following is for stores combobox
var readerLocation = new Ext.data.WCFJsonReader({
root: 'data', id: 'Store', totalProperty: 'totalCount',
fields: [
{ name: 'Store', type: 'int' },
{ name: 'StoreName', type: 'string' }
/*0:'All', '1':'ShangHai', '2':'BeiJing' */
]
});
var storeStore = new Ext.data.Store({
proxy: new Ext.data.WCFHttpProxy({
url: '/*.svc/GetStoresList'
}),
reader: readerLocation,
remoteSort: true,
listeners: {
load: function() {
comboLocation.setValue(comboLocation.getValue());
}
}
});
var comboLocation = new Ext.form.ComboBox({
store: storeStore,
displayField: 'StoreName',
valueField: 'Store',
id: 'comboboxStore',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
value: '',
width: 180,
applyTo: 'ddlStore'
});
storeStore.load();
storeStore.on("load", onstoreStoreLoad, storeStore, true);
function onstoreStoreLoad() {
if (storeStore.getTotalCount() > 0)
comboLocation.setValue(storeStore.getAt(0).data.Store);
}
/*** above is for location ***/
点击按钮 取值like:
Ext.get("btnFilter").on("click", displayGrid);
function displayGrid() {
var storeFilter = comboLocation.getValue();
});
///following is for stores combobox
var readerLocation = new Ext.data.WCFJsonReader({
root: 'data', id: 'Store', totalProperty: 'totalCount',
fields: [
{ name: 'Store', type: 'int' },
{ name: 'StoreName', type: 'string' }
/*0:'All', '1':'ShangHai', '2':'BeiJing' */
]
});
var storeStore = new Ext.data.Store({
proxy: new Ext.data.WCFHttpProxy({
url: '/*.svc/GetStoresList'
}),
reader: readerLocation,
remoteSort: true,
listeners: {
load: function() {
comboLocation.setValue(comboLocation.getValue());
}
}
});
var comboLocation = new Ext.form.ComboBox({
store: storeStore,
displayField: 'StoreName',
valueField: 'Store',
id: 'comboboxStore',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
value: '',
width: 180,
applyTo: 'ddlStore'
});
storeStore.load();
storeStore.on("load", onstoreStoreLoad, storeStore, true);
function onstoreStoreLoad() {
if (storeStore.getTotalCount() > 0)
comboLocation.setValue(storeStore.getAt(0).data.Store);
}
/*** above is for location ***/
点击按钮 取值like:
Ext.get("btnFilter").on("click", displayGrid);
function displayGrid() {
var storeFilter = comboLocation.getValue();
});
相关文章推荐
- 【学习笔记javascript设计模式与开发实践----1】
- jstl_XML标签库
- js之DOM操作(创建元素节点createElement)
- js == 与 === 的区别[转]
- JS自定义功能函数实现动态添加网址参数修改网址参数值
- json对象互转
- jsp自定义标签学习笔记
- js 正则 元字符转义
- js urlencode , encodeURIComponent
- CRM ribbon按钮上引用JS库
- Javascript错误
- JS中的对象数组
- js之DOM操作(替换元素节点replaceChild())
- Ajax与json在前后端中的细节解惑
- Datatable转换为Json 然后,Json数据导入 js 档
- js之DOM操作(删除节点removeChild())
- jsoncpp数组下标为0时的访问注意事项 这样应该算是严重bug
- JSTL I18N 格式标签库 使用之二_____读取消息资源
- js图片上传预览功能
- JS window对象指定大小页面