Category: Appsmith Support
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Cell color propagates to empty rows if only one row has data

Issue

I'm having an issue where the background color of a table cell is not calculated correctly when there is only one row of data in the table. All rows end up with the same color. I shared the JS snippet I used but it didn't help. Appsmith support suggested deleting and recreating the table, as it was an old version with a bug. I'm hesitant to do that as I might lose important data. I also have another problem where a JS function doesn't get triggered on page load, even though the first row is actually selected. Support suggested using an appsmith store value to reference the selected row instead.

Resolution

The issue reported by the user was with a table cell whose background color was calculated from its value in a JS function, which worked well in all cases except when there was only one row with data in that table. In that case, every row's cell got that color.

After investigating the issue, it was found that the table the user was using was an old version of the Table widget which had a bug. To resolve the issue, the user was recommended to delete the old table and create a new one.

The user also reported a separate issue where an iframe was not getting populated based on the current selection in the master table. It was found that this was because on page load, the selectedRow value was undefined until a row was clicked. To resolve this, it was recommended to use an Appsmith store value to reference the selected row in the table and iframe components.

The solution involved setting the store value to 0 on page load, updating it on row selection, and referencing it in the components instead of using the Orders.selectedRow value. An example code snippet was also provided for reference.