对组合框

时间:2017-05-23 06:57:15

标签: extjs

我有一个弹出窗口,我有一个下拉列表。当我将下拉列表的值更改为其他值时,它会显示脏检查的橙色三角形,但如果我将下拉列表的值更改回先前的值,则仍会显示脏选中标记。

如果值在下拉列表中更改回原始值,我希望下拉列表不显示脏选中标记。

分享我的代码

columns: {
    defaults: {
        align: 'left',
        flex: 2
    },
    items: [{
            xtype: 'actioncolumn',
            localized: {
                text: 'commonTranslations.function'
            },
            items: [{
                iconCls: 'iwp-icon-gen_edit',
                handler: 'onEditClick',

                getTip: function() {
                    return I18n.get('commonIconTranslations.penReleaseConcepts')
                }
            }],
            align: 'center',
            flex: 1
        },
        {
            localized: {
                text: 'commonTranslations.description'
            },
            dataIndex: 'title',
            renderer: CommonRendererUtils.htmlEncode
        },
        {
            localized: {
                text: 'commonTranslations.fileName'
            },
            dataIndex: 'filename',
            renderer: CommonRendererUtils.htmlEncode
        },
        {
            xtype: 'actioncolumn',
            localized: {
                text: 'commonTranslations.file'
            },
            items: [{
                getClass: function(v, metadata, r) {
                    if (!r.get('filename')) {
                        return 'x-hidden'
                    } else {
                        return 'iwp-icon-zeb_folder'
                    }
                },
                getTip: function() {
                    return I18n.get('commonIconTranslations.halfOpenFolder')
                },
                handler: 'onDownloadClick'
            }],
            align: 'center',
            flex: 1
        },
        {
            localized: {
                text: 'commonTranslations.source'
            },
            dataIndex: 'source',
            flex: 1
        },
        {
            localized: {
                text: 'details.tabview.scope.contents.release.main.uploadDate'
            },
            dataIndex: 'changeDate',
            xtype: 'dynamicTimestampColumn'
        },
        {
            localized: {
                text: 'details.tabview.scope.contents.release.main.uploadBy'
            },
            dataIndex: 'changeUser',
            xtype: 'usercolumn'
        },
        {
            localized: {
                text: 'commonTranslations.status'
            },
            /*-----facing issue for the column*/
            dataIndex: 'status',
            renderer: function(value) {
                return value.germanDescription;
            }

        },
        {
            localized: {
                text: 'commonTranslations.changeReason'
            },
            dataIndex: 'changeReason',
            renderer: CommonRendererUtils.htmlEncode
        },
        {
            localized: {
                text: 'commonTranslations.modulOrg'
            },
            dataIndex: 'modulOrgs',
            renderer: function(value, metaData, record) {
                if (record.isModified(metaData.column.dataIndex)) {
                    console.log("modified 9999999" + record.isModified(metaData.column.dataIndex));
                    metaData.tdCls += 'x-grid-dirty-cell';
                }
                var formattedValue = "";
                if (value) {
                    value.forEach(function(modulOrg) {
                        formattedValue += modulOrg.modulOrg + ", ";
                    });
                }
                return formattedValue.substring(0, formattedValue.length - 2);
            },
            flex: 1
        },
        {
            localized: {
                text: 'details.tabview.scope.contents.release.main.historyIndex'
            },
            dataIndex: 'historyIndex',
            flex: 1
        }
    ]
}

1 个答案:

答案 0 :(得分:0)

我认为你有太多的代码。无论如何,您可以添加一个更改事件监听器,如下所示:

listeners:{
    change:'combochange'
}

现在您可以在控制器中编写此combochange函数,或者您只能在视图中定义此函数。

combochange:function(field,newValue,oldValue,e){
// Inside this function you will get both the values of the dropdown of 
yours where newValue is the value currently selected and oldValue is the 
previous value. So inside this function according to your conditions you 
can put a check that if the old and newvalue matches then not to show the 
orange triangle.
}

如果有任何问题,请告诉我。快乐学习:)

相关问题