简体   繁体   English

Sencha ExtJS 4.2:如何在网格中同步两个组合编辑器?

[英]Sencha ExtJS 4.2: how can I synchronize two combo editors in a grid?

I need to edit two columns of my grid using combos as editors, and I need the values shown in the second to be filtered accordingly to the value selected in the first one. 我需要使用连击作为编辑器来编辑网格的两列,并且需要将第二个中显示的值与第一个中选择的值相对应地进行过滤。 There is also the problem that I need to show the "bound" value (ie "description") instead of the Id, in the grid cell. 还有一个问题,我需要在网格单元中显示“绑定”值(即“描述”)而不是Id。 I prepared a (very simplified) fiddle to show the problem here 我准备了一个(非常简化的)小提琴以在此处显示问题

Click here for the fiddle 点击这里小提琴

Looking at the fiddle, I'd need to select the brand in the first combo and then a model in the second, but I should obviously find only the models from the selected brand in there. 看小提琴,我需要在第一个组合中选择品牌,然后在第二个组合中选择一个模型,但是显然,我应该只在其中选择所选品牌的模型。 How can I show the descriptive text in the cell? 如何在单元格中显示说明性文字? How can I filter the second combo? 如何过滤第二个组合?

Thanks 谢谢

The editing plugin has an beforeedit event you can use, for example: 编辑插件具有您可以使用的beforeedit事件,例如:

listeners: {
    beforeedit: function(editor, context) {
        var record = context.record;

         if (context.field !== 'modelId') {
             return;
         }

         models.clearFilter(true);

         models.filter({
             property: 'brandId',
             value: record.getId()
        });
    }
}

Working example: https://fiddle.sencha.com/#fiddle/12hn 工作示例: https : //fiddle.sencha.com/#fiddle/12hn

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

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