菜鸟求助,初始化了一个extjs combox,但是无法获得其中的值 本帖最后由 toss2000 于 2011-03-30 09:20:38 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我给你个例子看看吧 var user_dataProxy = new Ext.data.HttpProxy({ url: '__URL__/usershow', method: 'POST' }); var user_dataReader = new Ext.data.JsonReader({ root: 'root', id: 'id', fields:['id','name'] }); var user_store = new Ext.data.Store({ proxy: user_dataProxy, reader: user_dataReader, autoLoad: true }); var combouser =new Ext.form.ComboBox({ xtype:"combo", fieldLabel: 'Author', name: 'authorlist', store:user_store, displayField:'name', valueField: 'id', mode: 'remote', editable:false, width:200, triggerAction: 'all', emptyText:'Select an user', //readOnly: true, hiddenName: 'author' }); 你的逻辑有问题吧你在load的时候 数据请求还没返回呢你就去取数据~~你可以在其他时候取值 例如在整个页面加载的最下面 写一个方法在里面获取到上面combox的值 自己搞定了,代码如下,希望对需要的兄弟们有所帮助var templateStore = new Ext.data.JsonStore({ url:'../templateManage.do?method=queryAllTemplate', root : 'root', autoLoad:true, fields:[{ name : 'reportId', type : 'int' },{name:'name',type:'string'}]}); templateStore.on('load',function() { combo.setValue(templateStore.getAt(0).get("reportId")); historyStore.baseParams.conditions =combo.getValue();//注意只能在这个地方获得combo.getValue()的值,其他地方获得不了这个值,historyStore也是一个数据集,需要首先获得combo.getValue()的值作为参数进行加载 historyStore.load(); }); 先晒晒,之后揭帖 进, 都给分! 拆分String,急...... 下拉框的兼容问题,请教各位大侠们。。。 怎么让eclipse运行到短点时自动调试 SQL2K还原数据的问题 怎样实现类似www.goobaidugle.com这样的网页 ~~Frameset与Action的严重问题! 替换了上传图片后为什么看到的还是以前的图片。 tag令我疯了 如何调试servlet程序? 高手速来围观啦 帅哥们 Document root element is missing ,看看这个错误。。
url: '__URL__/usershow',
method: 'POST'
}); var user_dataReader = new Ext.data.JsonReader({
root: 'root',
id: 'id',
fields:['id','name']
}); var user_store = new Ext.data.Store({
proxy: user_dataProxy,
reader: user_dataReader,
autoLoad: true });
var combouser =new Ext.form.ComboBox({
xtype:"combo",
fieldLabel: 'Author',
name: 'authorlist',
store:user_store,
displayField:'name',
valueField: 'id',
mode: 'remote',
editable:false,
width:200,
triggerAction: 'all',
emptyText:'Select an user',
//readOnly: true,
hiddenName: 'author'
});
var templateStore = new Ext.data.JsonStore({
url:'../templateManage.do?method=queryAllTemplate',
root : 'root',
autoLoad:true,
fields:[{
name : 'reportId',
type : 'int'
},{name:'name',type:'string'}]});
templateStore.on('load',function()
{
combo.setValue(templateStore.getAt(0).get("reportId"));
historyStore.baseParams.conditions =combo.getValue();//注意只能在这个地方获得combo.getValue()的值,其他地方获得不了这个值,historyStore也是一个数据集,需要首先获得combo.getValue()的值作为参数进行加载
historyStore.load();
});
先晒晒,之后揭帖