1

首先感谢大家对这些论坛的贡献/帮助。我已经在网上搜索了几天,但我无法/找到解决方案/找出问题所在。我有一个表单面板,它最初有一组字段(组合框、文本字段、按钮等)的单行(使用 hbox 布局的容器),用户可以使用这些字段来构建布尔语句。该容器还有用于“AND”、“OR”和“DEL”的按钮,可用于附加另一行(布尔语句)或删除当前行到表单面板。我有组合框值的本地商店,这一切都很好/很好......有点。我的问题是在用户在任何组合框中输入了一个值并且当他们添加新行时,新行的组合框列表仅限于在前一行中选择的内容 - 并且仅限于该值。我可以看到新行组合框的存储通过 firebug 具有所有正确的值,但这些值无法通过 GUI 访问。我以为是浏览器问题,但在 Ffox 和 IE 中都无法解决。如果他们只通过鼠标进行选择,那绝对不是问题。我尝试使用字段集而不是容器来删除组合框配置等,在线搜索。有什么想法/想法吗?

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
    }
}]
});
4

1 回答 1

0

不要为不同的组合框重复使用商店。为每一行的每个组合创建新商店。这是因为,当您键入时,您正在过滤组合框中的数据。数据包含在商店中,因此您基本上是在过滤商店,它在组合之间共享。

因此,一旦您过滤了第 1 行,过滤器就会对第 2 行保持活动状态。如果每个组合都使用新存储,则不会出现问题。

于 2013-02-19T03:31:40.177 回答