I'm using JQgrid to draw a table in my jsp. For one of the columns, I have a custom formatter:
function profileConsentFmatter (cellvalue, options, rowObject)
{
if (options.colModel[12] == "CORPADMIN") {
return "Company Admin";
} else if (cellvalue == "true") {
return "Yes";
} else {
return "Pre GDPR";
}
}
As you can see, I want the value of this column, to depend on the value of another column. How do I do that? I tried different methods from the documentation and they don't seem to work.
You can use the rowObject
parameter. It has all the data for that row but the rowObject format depends on the format of data it received from the server.
function profileConsentFmatter (cellvalue, options, rowObject)
{
if (rowObject.AdminType == "CORPADMIN") {//assuming JSON here
return "Company Admin";
} else if (cellvalue) {
return "Yes";
} else {
return "Pre GDPR";
}
}
This should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.