簡體   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