Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs链接组合-让父值具有相同的子值_Extjs_Combobox - Fatal编程技术网

Extjs链接组合-让父值具有相同的子值

Extjs链接组合-让父值具有相同的子值,extjs,combobox,Extjs,Combobox,如果父值具有唯一标识符,则可以使用链接组合。 但是,我在父组合中有4个选项,它们应该与子组合具有相同的值。我在存储中给了它们相同的标识符,但是当我选择它们中的任何一个时,组合中的值都不会改变 是否可以在不复制所有值的情况下执行此操作 商店 组合 您可以改用filterBy函数。以下是方法: opCombo.store.filterBy( function(record, id) { if((record.data.id == 1 || record.data.id == 2)

如果父值具有唯一标识符,则可以使用链接组合。 但是,我在父组合中有4个选项,它们应该与子组合具有相同的值。我在存储中给了它们相同的标识符,但是当我选择它们中的任何一个时,组合中的值都不会改变

是否可以在不复制所有值的情况下执行此操作

商店

组合


您可以改用filterBy函数。以下是方法:

    opCombo.store.filterBy( function(record, id) {
      if((record.data.id == 1 || record.data.id == 2) && (this.id == 1 || this.id == 2)) {
    // specify index that you want to exclude when getting say parent combo value 1 or 2
          return false; // excludes the record in the store
      } else {
          return true; // includes the record in the store.
      }
    } , combo );

所做的只是在子组合中显示每个值,而不是选择一个值。我遇到的问题是,几个父选项具有相同的子选项,但父选项显示这3个选项中的第一个(名称),无论选择了哪一个
xtype:'combo',                             
                        id: 'fieldSelecCmb1',                                                   
                        width: 125,                                     
                        displayField: 'field',
                        valueField: 'fid',                      
                        hideLabel: true,  
                        store: storeField ,
                        triggerAction: 'all',
                        mode: 'local',
                        value: "Choose a field",
                        listeners:{ 
                            select: { 
                                fn:function(combo, value){                                         
                                    var id = combo.id;
                                    var rowNo = id.charAt(id.length-1);
                                    var opCombo = Ext.getCmp("optionSelectCmb"+rowNo);
                                    opCombo.clearValue();
                                    opCombo.store.filter("fid", combo.getValue());                                 

                                }  
                            }
    opCombo.store.filterBy( function(record, id) {
      if((record.data.id == 1 || record.data.id == 2) && (this.id == 1 || this.id == 2)) {
    // specify index that you want to exclude when getting say parent combo value 1 or 2
          return false; // excludes the record in the store
      } else {
          return true; // includes the record in the store.
      }
    } , combo );