简体   繁体   English

仅在extjs网格中添加组合框

[英]Add combobox in extjs grid for only one row

I have an extjs grid which shows data from a store. 我有一个extjs网格,它显示来自商店的数据。 The last column is always empty except for the entry in store where, a flag is_deleted=0 (Only one entry will have is_deleted=0). 除了存储区中的条目is_deleted=0 (只有一个条目的is_deleted = 0)外,最后一列始终为空。 I have to show a combobox for this entry with values edit and delete. 我必须显示此条目的组合框,并带有值编辑和删除。

The current grid code I have is as follows: 我当前拥有的网格代码如下:

Ext.define('TasoDesktop.view.taso.popups.accountComments.AccountCommentsGrid', {
extend: 'Ext.grid.GridPanel',
alias: 'widget.tasoAccountCommentsGrid',

title: 'Previous Comments',

initComponent: function () {
    this.store = 'AccountLevelComments';

    this.columns = [
        { header: 'Date Entered', dataIndex: 'modified_dt', flex: 0},
        { header: 'Comment', dataIndex: 'c_comment', flex: 0 },
        { header: 'Entered by', dataIndex: 'sid', flex: 0 },
        { header: 'Expiry Date', dataIndex: 'valid_until_dt', flex: 0 },
        { header: 'Action', flex: 0 }
    ];

    this.height = 400;
    this.width = 900;

    this.viewConfig = {
        stripeRows: true
    };

    this.autoScroll = true;

    this.callParent(arguments);
}
});

Only one of the Action column( with is_deleted = 0 in the store) should have the combo-box. 组合框只能是“操作”列之一(商店中的is_deleted = 0)。 How should I include the combobox for it based on the store value? 我应该如何根据商店的价值为其添加组合框?

Any column editor is defined per-column so you cannot define an editor for column-and-row. 每个列都定义了任何列编辑器,因此您不能为列和行定义编辑器。 What you can do is to conditionally disable the editing for rows that do not match your criteria. 可以做的是有条件地禁用对不符合您的条件的行的编辑。

For that, listen to beforeedit event and return false from the listener is the criteria do not match. 为此, 如果条件不匹配,请侦听beforeedit事件并从侦听器返回false。

在标题为Action的列上添加xtype:'checkcolumn',并为该列的dataindex属性分配值,您需要从存储中进行分配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM