所以我在通过制表符从数据库中获取数据后填充表。
例如,多维数据数组在每个索引[0- ..]中都有以下键和数据:
["code", "notation", "ztotal"]
我只会在表格中显示notation
和ztotal
,而不显示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();
// dropdown1,2,3 contains array for pull down menu
if(code == 1) return dropdown1;
else if(code == 2) return dropdown2;
else return dropdown3;
}