繁体   English   中英

根据填充表的数据值设置制表符 editorParams

[英]Set tabulators editorParams depending on the value of data from which table is populated

所以我在通过制表器从数据库中获取数据后填充一个表。

例如,多维数据数组在每个索引 [0-..] 中都有以下键和数据 -

["code", "notation", "ztotal"]

我只会在表格中显示notationztotal ,而不是code 但用户可以更改ztotal ztotal的下拉列表有 3 种可能性,这取决于code的值。 如果可能的话,我想做如下的事情

...blah blah
    {title: "NOTATION", field: "notation", frozen:true}
    {title: "ZTOTAL", field: "ztotal", editor: "select", editorParams:{values:getDropDown(code)}}
...blah blah
...
function getDropDown(code) {
    if(code == 1) return dropdown1;
    else if(code == 2) return dropdown2;
    else return dropdown3;

我如何实现这一目标? 谢谢是提前

想通了,猜别人会发现它有用。

{title: "ZTOTAL", field: "ztotal", editor: "select", editorParams:{values:getDropDown}}
.........
function getDropDown(cell) {
    code = cell.getRow().getData()["field_name"];
    // dropdown1,2,3 contains array for pull down menu
    if(code == 1) return dropdown1;
    else if(code == 2) return dropdown2;
    else return dropdown3;
}

暂无
暂无

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

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