Add combobox in extjs grid for only one row
我有一个extjs网格,它显示商店中的数据。除了存储区中的条目
我当前拥有的网格代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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); } }); |
只有"操作"列之一(商店中的is_deleted = 0)应该具有组合框。我应该如何根据商店价值为其添加组合框?
每个列都定义了任何列编辑器,因此您不能为列和行定义编辑器。您可以做的是有条件地禁用对不符合您的条件的行的编辑。
为此,如果条件不匹配,请侦听beforeedit事件并从侦听器返回false。
为具有标题为Action的列添加xtype:'checkcolumn'并为该列分配dataindex属性,并为其赋值,您需要从存储中进行赋值。