Topic: Datatable Cells format function not changing colors on table render.
What I am expecting to happen is that whenever I filter the datatable or paginate the table, the format function on the tables cell to run and change the color based on what is shown. I thought maybe I was doing something wrong, but I see it also does it on your example of the datatable cells format
It seems the color gets rendered onto the cells style attribute the first time around, but then never happens again whenever the table is re-rendered or filtered or anything. I believe this might be a bug in your datatable, but I could be wrong.
{
label: 'Status',
field: 'status',
format: function (cell, value) {
switch (value) {
case 'Draft':
cell.style.backgroundColor = 'rgba(23, 162, 184, 0.8)';
break;
case 'Submitted For Approval':
cell.style.backgroundColor = 'rgba(255, 193, 7, 1)';
break;
case 'Awaiting Approval':
cell.style.backgroundColor = 'rgba(253, 126, 20, 0.8)';
break;
case 'Approved':
cell.style.backgroundColor = 'rgba(0, 123, 255, 0.8)';
break;
case 'Rejected':
cell.style.backgroundColor = 'rgba(220, 53, 69, 0.8)';
break;
case 'Awaiting Invoice':
cell.style.backgroundColor = 'rgba(149, 53, 83, 0.8)';
break;
case 'Invoice(s) Received':
cell.style.backgroundColor = 'rgba(40, 167, 69, 0.5)';
break;
case 'Complete':
cell.style.backgroundColor = 'rgba(40, 167, 69, 1)';
break;
default:
cell.style.backgroundColor = 'transparent';
break;
}
cell.style.color = 'white';
cell.style.textAlign = 'start';
},
},
Grzegorz Bujański staff answered 5 months ago
Yes, it's a component bug. Thanks for reporting. We will fix it as soon as possible.
Twizza pro premium priority commented 5 months ago
Thank you, is there any chance there is an ETA on how long a fix like this would take ? I need to know as we are pushing to prod soon and I need to know whether to find a different way around this
Grzegorz Bujański staff answered 5 months ago
Unfortunately, I am unable to provide the exact release date. We are currently working on a major update of the MDB package and the next version will probably not be released until September.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 7.3.2
- Device: Desktop PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No