Unexpected result with Custom Data Viewer

When I preview this code on Thunkable Live or as a web app, it creates a new row in the local db but doesn’t change the text and background colors unless it’s the last row of the db.

Here’s the database contents:

So if I preview it once, I get this:

But if I then preview it again, I get this:

Why doesn’t the second to last list item also have the correct color scheme?

And… if I use a variable for the row id, it then adds TWO rows every time I preview it instead of one.

Here’s a link to that version of the project:

https://x.thunkable.com/copy/4ea2b55b63fa4dadb7dbe253c4a77143

@Steven is this bug still relevant to what’s happening to me?

For your first question, your blocks are only setting the background color and text color for the newly created row because that is the id being returned. If you want it to be applied to all of the rows you have two options:

  1. You would need to use the list of values block to get all the ids and the relevant values to set the colors. Then use the setter and getter blocks along with the ids to set the background color/text color for every row.
  2. If you wanted to use Google sheets or Airtable you could make the colors a column and have a formula determine what color the background and text should be. You could then bind those columns to the values for background color and text color.

Does that make sense?

As for your second question, that isn’t something I’ve seen before. I’ll take a look and see if I can determine what is going on. I do not think that bug is still relevant though it is possible. I’ll let you know once I have a better idea.

I looked into the second issue you mentioned of two rows being created. I don’t think this is an issue with the create row block itself but rather a result of using the Opens block for the screen. It seems the screen is opening twice on the initial load for some reason. So this is an issue, but separate from the data source block. Can you confirm if you were seeing this issue on web only or was it also happening on your Thunkable Live app?

1 Like

I get it now. I was expecting the background color to “stick” but since I’m not saving it anywhere, the custom data viewer layout is just using the color that was entered as a layout.

I think it was happening on Thunkable Live. Definitely as a web app. I’m now looking into ways to update the color for all list items. So I’ve moved on a bit but I can still help troubleshoot this if needed. I think part of it was my misunderstanding about the background color not changing.

No need to help troubleshooting but thanks for offering! Let me know if you have any other questions I can help with.

I guess it isn’t entirely clear that changing the props to the dv layout components are temporary changes. So that is something we should work on clarifying.