打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
页面加载时给comboBox给一个默认值
 效果图如下:当页面在加载就给发卡集团给出默认值,然后,根据发卡集团自动查询出grid记录
-------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
var _cgcode=null;

//这里定义comboBox的Store,从数据库读取数据
var cgcodeStore = new Ext.data.JsonStore({
url : 'demand_getCorpCGCode.do',
totalProperty:'totalCount',
root:'data',
fields : [
{name : 'cgcode',type : 'string'},
{name : 'rownum',type : 'string'}
]
});


//这里定义comboBox
var co_cgcode = new Ext.form.ComboBox({
//xtype : 'combo',
//labelStyle : '{font-weight:bold}',
id : this.genId('p_cgcode'),
name:'p_cgcode',
triggerAction:'all',
mode:'local',
store : cgcodeStore,
editable:false,
editable : false,
allowBlank : false,
autoLoad:true,
//blankText : '发卡集团编号不能为空',
valueField : 'cgcode',
//tpl:'<tpl for="."><div class="x-combo-list-item">[{cgcode}]{cgname}</div></tpl>',
displayField : 'cgcode',
listeners:{
scope:this,
render:{
fn:function(sto,opt){
//alert("==="+sto.getStore().getCount());
//cgcodeStore.getAt(0);
}
},
select:function(sto,opt){
//alert("===---"+sto.getStore().getCount());
}
}
});
//关键是这里:直接加载store,在加载时调用回调函数,在回调函数里给comboBox赋初始值,然后根据初始值调用grid的Store加载,
cgcodeStore.load({
callback : function(){    
//alert(cgcodeStore.getCount());
        co_cgcode.setValue(cgcodeStore.getAt(0).get('cgcode'));
        _cgcode=cgcodeStore.getAt(0).get('cgcode');
        demandmsStore.load({
params : {
corpid:gCorpId,
cgcode:_cgcode,
start : 0,
limit : gLimit
}
});
       
}   
});
-----------------------------------------------------------------------------------------------------------------------------------
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
解决电脑开机慢的方法
ext1中Ext.form.ComboBox默认值的设置
九大技巧,提升xp运行速度100%
Ext中向Ext.grid.GridPanel() 显示按钮,并绑定id(行标识)
获取Ext grid数据
对Extjs中store的多种操作
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服