简体   繁体   English

ExtJS网格动态组合框

[英]ExtJS grid dynamic combobox

i have this case: i have product which have many warehouse, and a warehouse have many units 我有这种情况:我的产品有很多仓库,而一个仓库有很多单元

i have warehouse combobox and units combobox, when i change the value of warehouse combobox, the values in Units combobox changed (the same record). 我有仓库组合框和单位组合框,当我更改仓库组合框的值时,单位组合框中的值也更改了(同一条记录)。

here i make some sencha fiddle about it: https://fiddle.sencha.com/#view/editor&fiddle/1o08 在这里我为此做些煎茶: https : //fiddle.sencha.com/#view/editor&fiddle/1o08

when i edit a warehouse combobox the listener read all the record on the grid & change another combobox value in different record. 当我编辑仓库组合框时,侦听器将读取网格上的所有记录并在其他记录中更改另一个组合框值。

what i want is when i change warehouse in record 1 then only units combobox in record 1 that changed. 我想要的是当我在记录1中更改仓库时,则仅更改了记录1中的单元组合框。 i'm using ExtJS 5.0.1. 我正在使用ExtJS 5.0.1。

Any help would be appreciated, Thanks. 任何帮助,将不胜感激,谢谢。

Your itemupdate listener is calling widget.setStoreManually for all the comoboxes. itemupdate听众呼吁widget.setStoreManually所有comoboxes。 We have to call it only for the corresponding combobox. 我们只需要为相应的组合框调用它即可。 We will only it when the recordId of the widget & the updated records matches. 当窗口小部件的recordId与更新的记录匹配时,我们才使用它。

Your itemupdate listener will look like: 您的itemupdate侦听器将如下所示:

itemupdate: function(rec,idx) {
            if(widget.getWidgetRecord().id==rec.id) // only when both id matches
               widget.setStoreManually(widget, rec)
}

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

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