Put the data from a column, in to a listview

I am trying to take the data from a column in a table to a listview. But how do I do that. Because for each array in my column I want a unique row in my listview.

@DionC
Can you post some data as an example?

Without seeing the example data @ScottR asked for, this is a stab in the dark.

Each component in your ListView will need a Default Value something along these lines"

{{myTable.selectedRow.data.myArrayDataField[i]}}

https://docs.retool.com/docs/create-custom-list-views

image
Sorry for my late response, but these 3 keys have al a different name and I want that each name fill a different text component in my listview. See picture below

image

I fixed it already!

So happy to hear that! (and thank you as always Scott + Brad for hopping in here)

What was the fix @DionC, if I may ask?

I used @bradlymathews his solution, first I thought it didn't work, but it was a typo on my part :confused:

1 Like

I'm trying to display all columns for the selected row in the list view but am having difficulty

The documentation speaks mostly about rows - https://docs.retool.com/docs/create-custom-list-views


Hey @Eden!

So table1.selectedRow.data returns an object containing the column names and the values for the selected row. Something like:

{“name”: “Larry”, “id”: 3, “age”: 999}

If you want to show the id in number field, you could do something like:

{{ table1.selectedRow.data.id }}

In your screenshot, it looks like you’re trying to show an entire table’s column in your list view, is that correct?

Ah I see, I'm looking to return only the values of all columns in the selected row.

And in the Label, I'm looking to return all columns names

Got it! This seems definitely doable :slight_smile:

Perhaps something like this?

For the length of the list view, I set it to {{_.keys(table1.selectedRow.data).length}}

You could also use a Key Value component for a similar effect!

Amazing @victoria! it works!
I did try key value before and that's much easier, but it doesn't allow for editing the data.

Here's a tricky one (I think) - How would I set the list of component types dynamically for different columns based on the column types- Text, Num, Email, Dropdown, Boolean

I would assume that's too complex?

Actually...I should've thought about this earlier.

Have you tried just using the Form component? It's pretty magical.

If you drag a Form component onto your app and click "generate form", it can generate a form based on your table! It'll even automatically pick the input types (e.g. number, email) and connect the selectedRow data to the form itself.

Would something like that work for you?
form from selectedrow.gif

Oh! True that! That should work perfectly :))

Oh awesome! Hopefully it does :slight_smile: Have you had a chance to try it out?

yep, it works!
Thank you Victoria!