[英]JQgrid accessing value from another column
我正在使用JQgrid在我的jsp中繪制表格。 對於其中一列,我有一個自定義格式化程序:
function profileConsentFmatter (cellvalue, options, rowObject)
{
if (options.colModel[12] == "CORPADMIN") {
return "Company Admin";
} else if (cellvalue == "true") {
return "Yes";
} else {
return "Pre GDPR";
}
}
如您所見,我希望此列的值取決於另一列的值。 我怎么做? 我嘗試了與文檔不同的方法,但它們似乎不起作用。
您可以使用rowObject
參數。 它具有該行的所有數據,但rowObject格式取決於它從服務器接收的數據格式。
function profileConsentFmatter (cellvalue, options, rowObject)
{
if (rowObject.AdminType == "CORPADMIN") {//assuming JSON here
return "Company Admin";
} else if (cellvalue) {
return "Yes";
} else {
return "Pre GDPR";
}
}
這應該工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.