首先感谢大家对这些论坛的贡献/帮助。我在网上搜索了好几天,都找不到解决问题的办法。我有一个表单面板,它最初有一行(使用hbox布局的容器),包含一组字段(组合框、文本字段、按钮等),用户可以使用这些字段来构建布尔语句。此容器还有"AND"、"OR"one_answers"DEL"按钮,可用于将另一行(布尔语句)追加到表单面板或删除当前行。我有combobox值的本地商店,这一切都很好。。。有点。我的问题是,当用户在任意组合框中键入值后,当他们添加新行时,新行的组合框列表仅限于前一行中选择的值,并且仅限于该值。我可以通过firebug看到新行的combobox的存储区具有所有正确的值,但这些值不能通过GUI访问。我以为这是浏览器的问题,但在Ffox和IE中都无法更改。如果他们只通过鼠标进行选择,那就不会有问题。我试着去掉combobox配置等,在线搜索,使用字段集而不是容器。有什么想法吗?
Ext.define('SearchTool.view.main.component.QueryBuilderRow', {
extend: 'Ext.container.Container',
alias: 'widget.builderRow',
requires: ['SearchTool.config.Config'],
layout: 'hbox',
items: [{
xtype: 'combo',
cls: 'cboxFields',
store: new Ext.data.SimpleStore({
fields: ['fieldname', 'fieldvalue'],
data: [
['field1', 'FIELD1'],
['field2', 'FIELD2'],
['field3', 'FIELD3'],
['field4', 'FIELD4']
]
}),
editable: true,
selectOnFocus: false,
forceSelection: true,
displayField: 'fieldname',
valueField: 'fieldvalue',
emptyText: '(Select Field)',
typeAhead: true,
value: '',
triggerAction: 'query',
queryMode: 'local',
width: '15%'
}, {
xtype: 'combo',
cls: 'cboxOpers',
store: operStore,
displayField: 'opername',
valueField: 'opervalue',
emptyText: '(Select Oper)',
forceSelection: true,
typeAhead: true,
triggerAction: 'query',
shrinkWrap: 1,
selectOnFocus: false,
queryMode: 'local',
width: '15%',
enableKeyEvents: true
}, {
xtype: 'textfield',
// itemId: 'val1',
width: '18%',
emptyText: '(Enter value...)',
regex: SearchTool.config.Config.qryBuilderTextFieldRegex,
regexText: SearchTool.config.Config.qryBuilderErrText,
enableKeyEvents: true
}, {
xtype: 'combo',
cls: 'cboxAndOr',
store: andorStore,
minChars: 1,
disabled: true,
displayField: 'opername',
valueField: 'opervalue',
typeAhead: true,
emptyText: '(AND/OR)',
allowBlank: true,
enforceMaxLength: true,
matchFieldWidth: true,
mode: 'local',
width: '12%'
}, {
xtype: 'textfield',
width: '17%',
emptyText: '(Enter value...)'
}, {
xtype: 'hidden',
value: ''
}, {
xtype: 'button',
iconCls: 'icon-btnAdd',
text: 'AND',
width: '7%',
handler: function (t) {
t.up('panel').add({xtype:'builderRow'}); //add new row
t.up('panel').items.items[t.up('panel').items.items.length -
2].down('button').next('button').next('button').hide();
t.prev('hidden').setValue(' AND '); //to be passed in w/ form
}
}, {
xtype: 'button',
iconCls: 'icon-btnAdd',
text: 'OR',
width: '6.5%',
handler: function (t) {
t.up('panel').add({xtype:'builderRow'}); //add new row
t.up('panel').items.items[t.up('panel').items.items.length - 2].down('button').next('button').next('button').hide();
t.prev('hidden').setValue(' OR ');
}
}, {
xtype: 'button',
iconCls: 'icon-btnDelete',
text: 'DEL',
width: '7%',
handler: function (t, e, o) {
var i = t.up('panel').items.items;
var l = i.length; //length of the array of items
if (l > 2) i[l - 2].down('button').next('button').next('button').show();
i[t.up('panel').items.items.length - 2].down('hidden').setValue(''); //prev row hidden reset
t.up('panel').remove(t.up('container')); //remove this row
}
}]
});
不要为不同的组合框重用存储。为每行的每个组合创建新的存储。这是因为,当您键入时,您正在筛选组合框上的数据。数据包含在存储中,所以您基本上是在过滤存储,它在组合中共享。
因此,一旦对第1行进行了筛选,第2行的筛选器将保持活动状态。如果每个组合都使用一个新的商店,问题就不会出现。