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 如何更改Ext js combobox中某个值的索引_Extjs_Extjs4_Extjs4.1_Extjs4.2_Extjs3 - Fatal编程技术网

Extjs 如何更改Ext js combobox中某个值的索引

Extjs 如何更改Ext js combobox中某个值的索引,extjs,extjs4,extjs4.1,extjs4.2,extjs3,Extjs,Extjs4,Extjs4.1,Extjs4.2,Extjs3,我有一个从服务器端获取值列表的组合框。当我添加一个新的 值,它将反映在组合框的最后一个索引处。我的要求是 对于给定的值,我想把索引改为零 例如,如果我添加了x和y作为新值,现在我想更改 x的指数为零 我的组合框代码: { xtype : 'combo', //typeAhead : true, triggerAction : 'all', name : 'agreementTypeCombo', id : 'agreementTypeCombo',

我有一个从服务器端获取值列表的组合框。当我添加一个新的 值,它将反映在组合框的最后一个索引处。我的要求是 对于给定的值,我想把索引改为零

例如,如果我添加了x和y作为新值,现在我想更改 x的指数为零

我的组合框代码:

{
    xtype : 'combo',
    //typeAhead : true,
    triggerAction : 'all',
    name : 'agreementTypeCombo',
    id : 'agreementTypeCombo',
    //hiddenName : 'agreementTypeCombo',
    editable : false,
    mode : 'local',
    store : new Ext.data.JsonStore({

        fields : [{
                    name : 'id',
                    mapping : 'id'
                }, {
                    name : 'label',
                    mapping : 'label'
                }

        ],
        idProperty : 'id',
        data :  MD_updateOpportunityMasterDataVO.agreementTypeList
    }),
    valueField : 'id',
    displayField : 'label',
    //emptyText : CONST_NOT_AVAILABLE,
    fieldLabel : 'Agreement Type',
        labelStyle: 'font-weight:bold;',
    helpText : getFieldTip(MODULE_NAME,CATEGORY_SALES_SUMMARY,'Agreement Type'),
    //allowBlank : false,
    anchor : '95%',
    value : opportunityVO.agreementTypeId
}

如果您在本地添加它,请使用

store.insert(0, newItem);

如果您将其添加到服务器上,然后重新加载,则服务器必须按要求的顺序返回组合存储记录。

使用存储插入指定位置。您可以为每个记录添加额外的id字段,然后在存储加载的回调函数中对所有记录进行排序。您到底想这样做什么?