我正在尝试使用 AutoLoad:true 来组合加载项目(dataStore),但是,我不知道我是否正确这样做。我是 Extjs 的小新手,所以,请不要粗鲁,请嘿嘿
这是代码!
items: [{
xtype: 'form',
padding: 20,
name: 'formReplyParameters',
layout: 'anchor',
fieldDefaults: {
msgTarget: 'under',
labelAlign: 'top'
},
defaults: {
padding: 10
},
items: [{
xtype: 'checkboxfield',
name: 'interactive',
inputValue: true,
fieldLabel: 'Interactive',
anchor: '100%'
}, {
xtype: 'textfield',
name: 'timeResponse',
fieldLabel: 'Time response',
anchor: '100%'
}, {
xtype: 'combobox',
fieldLabel: 'Alert channel',
name: 'uuidResponseParameterType',
queryMode: 'local',
store: new Ext.data.Store({
fields: [{
name: 'description',
type: 'string'
}, {
name: 'name',
type: 'string'
}, {
name: 'uuid',
type: 'string'
}],
autoLoad: true,
hideTrigger: true,
minChars: 1,
triggerAction: 'query',
typeAhead: true,
proxy: {
type: 'ajax',
url: "../blabla",
actionMethods: {
create: "POST",
read: "POST",
update: "POST",
destroy: "POST"
},
extraParams: {
action: "catalog",
catalog: "parametersType",
params: JSON.stringify({
uuidToken: Ext.connectionToken
})
},
reader: {
type: 'json',
root: 'List'
},
listeners: {
exception: function(proxy, response, operation, eOpts) {
var responseArray = JSON.parse(response.responseText);
Ext.Notify.msg(responseArray.message, {
layout: "bottomright",
delay: 5000,
type: "error"
});
}
}
}
}),
anchor: '100%',
typeAhead: true,
triggerAction: 'all',
valueField: 'uuid',
displayField: 'description',
allowBlank: false,
listeners: {
change: function (combo, value) {
var type = combo.valueModels[0].data.name;
var channel = me.down('[name="uuidChanel"]');
channel.clearValue();
var channelStore = new Ext.data.Store({
fields: [{
name: 'description',
type: 'string'
}, {
name: 'name',
type: 'string'
}, {
name: 'uuid',
type: 'string'
}],
autoLoad: true,
hideTrigger: true,
minChars: 1,
triggerAction: 'query',
typeAhead: true,
proxy: {
type: 'ajax',
url: "../handler/custom/customEvent.ashx",
extraParams: {
action: "catalog",
catalog: type,
params: JSON.stringify({
uuidToken: Ext.connectionToken
})
},
reader: {
type: 'json',
root: 'list'
},
listeners: {
exception: function(proxy, response, operation, eOpts) {
var responseArray = JSON.parse(response.responseText);
Ext.Notify.msg(responseArray.message, {
layout: "bottomright",
delay: 5000,
type: "error"
});
}
}
}
});
channelStore.load();
channel.bindStore(channelStore);
}
}
}, {
xtype: 'combo',
name: 'uuidChanel',
fieldLabel: 'Channel',
valueField: 'uuid',
displayField: 'description',
anchor: '100%',
store: null,
allowBlank: false
}]
}]
问题在于组合: uuidChannel 如果有人可以提供帮助,非常感谢!
答案 0 :(得分:0)
为什么你认为autoLoad: true
有效?因为当你试图打开最后一个组合框拾取器时它还在装载吗?
我认为您的问题是,每次组合时都会创建新商店name: 'uuidResponseParameterType'
change
事件触发器和商店autoLoad: true
表示
存储的加载方法在创建后自动调用
您必须只创建一次商店并在组合extraParams
事件中使用新的change
加载(或在本地过滤)。
答案 1 :(得分:0)
事情就是(愚蠢)
channel.clearValue();
这个领域正在解决所有问题。这个" clearValue"是因为我相信删除" uuid"的数据,它正在用" bind"返回给我新的数据。到底部
<div class="clearfix prevent-float"></div>
所以,我认为我把新数据,但这个&#34; clearValue&#34;,只是用&#34; bind&#34;来删除数据。我失败了。所以,我只是简化了channelStore.load();
channel.bindStore(channelStore); <<<
,并解决了这个问题! :)