I have a requirement to change the class of the nominal_currency_id
cell based on information from the ch_nominal_currency_id_flag
column. I simply want to assign a background color to it.
I could use a renderer in the nominal_currency_id
cell, but this is impossible because I have a resolveView
that handles changing the ID to one retrieved from the dictionary. The renderer overrides this, and I still see the ID instead of the code value.
Therefore, I would like to add a renderer to the column with the ch_nominal_currency_id_flag
flag, but I don’t know how to add to the nominal_currency_id
column to assign a class to it. metadata
, of course, only works for the column containing the renderer.
In short, I want to apply a red background color to the nominal_currency_id
cell based on the value from the true/false ch_nominal_currency_id_flag
cell
How should I approach this?
{
name: 'nominal_currency_id',
title: 'Nominal Currency',
editable: true,
type: 'string',
maxLength: 3,
formSortOrder: 13,
resolveView: {
dataProviderId: 'PROVIDER_ID',
childrenTable: 'pd_currency',
remote: false,
valueField: 'currency_id',
displayField: 'currency_code',
addBlank: true
}
},
{
name: 'ch_nominal_currency_id_flag',
title: 'Ch Nominal Currency Flag',
editable: true,
type: 'boolean',
hidden: true,
hiddenInForm: true,
formSortOrder: 45
},
I also add the code that adds my resolveView
, maybe it will help in solving
if (column.resolveView !== undefined) {
;(() => {
const resolveView = column.resolveView
const columnName = column.name
let dropDownTemplate
let dropDownTemplateList
tempColumnType.filter = {
type: 'resolver',
addBlank: false,
underlyingField: columnName,
...resolveView,
control,
}
tempColumnType.renderer = function (value, _metaData, record) {
if (!_.isNil(value)) {
const retrivedValue = app.nameResolver.resolve(
{
value,
underlyingField: columnName,
...resolveView,
},
record?.data,
)
return _.isString(retrivedValue)
? _.unescape(retrivedValue)
: retrivedValue
}
}
if (column.editable !== false) {
tempColumnType.field = {
xtype: 'resolvercombo',
underlyingField: columnName,
...resolveView,
}
}
if (dropDownTemplate) {
tempColumnType.field.tpl = dropDownTemplateList
tempColumnType.field.displayTpl = dropDownTemplate
tempColumnType.filter.tpl = dropDownTemplateList
tempColumnType.filter.displayTpl = dropDownTemplate
}
})()
}