简体   繁体   English

基于 extjs 网格中的另一个组合框填充字段

[英]Populate Field based on another Combo Box in grid of extjs

In grid i have three column on column field have combo box and on change of combo box value auto populate another column respective field How to do this extjs在网格中,我在列字段上有三列有组合框,并且在组合框值更改时自动填充另一列相应字段如何做到这一点 extjs

enter image description here在此处输入图像描述

Please see above image for grid code.有关网格代码,请参见上图。

My Function is below我的 Function 在下面

autoPopulateCsid: function(grid, rowIndex, colIndex, item, e, record, row, action) { autoPopulateCsid:函数(网格,rowIndex,colIndex,项目,e,记录,行,动作){

/// i am not able to get whole record/row of grid which i am editing /// 我无法获得我正在编辑的整个记录/网格行

} }

i have to get record in function so i can update field of record and it will be dirty automatic.我必须在 function 中记录,这样我才能更新记录字段,它会自动变脏。 So on cancel i will discard all my changes for that perticular row所以在取消时,我将丢弃该特定行的所有更改

The combobox select event don't have all these parameters, the parameters it actually receives are combobox, newValue, oldValue, eOpts from there you can get your "row record" from your editor componenet like this. combobox select事件没有所有这些参数,它实际接收的参数是combobox, newValue, oldValue, eOpts从那里你可以从你的编辑器中获取你的“行”。

autoPopulateCsid: function(combobox, newValue, oldValue, eOpts) {
    let myRecord = combobox.up('editor').context.record;
     myRecord.set('collateralAgreement',newValue);

}

If you dont use myRecord.commit(), the record will be marked as dirty, after that if you want to discard those changes you can use rejectChanges() in the store of your grid.如果您不使用 myRecord.commit(),该记录将被标记为脏,之后如果您想丢弃这些更改,您可以在网格存储中使用rejectChanges()

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

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