JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › Change cell value based on other cell value › Reply To: Change cell value based on other cell value
March 22, 2023 at 8:08 am
#104602
Peter
Participant
Yes. This almost “works” – but the cells that should have icons from the start, don’t show their icon until I either scroll the grid, change window size or change the value of a cell – or similar change – then the icon appear right away as were they always there.
{
label: '', dataField: 'Attachments', cellsVerticalAlign: 'middle', cellsAlign: 'center', width: 50, freeze: 'far',
allowEdit: false, template: function (formatObject)
{
const data = formatObject.row.data;
if (!formatObject.template)
{
formatObject.template = '<div></div>';
}
if (data.attachment_count != null)
{
if (data.attachment_count < 1)
{
formatObject.template.innerHTML = '';
}
else if (data.attachment_count == 1)
{
formatObject.template.innerHTML = '<some fa icon A>';
}
else if (data.attachment_count > 1)
{
formatObject.template.innerHTML = '<some fa icon B>';
}
}
else
{
formatObject.template.innerHTML = '';
}
}
}
- This reply was modified 1 year, 6 months ago by Peter.