Nested Lists and "drilling down" via the Data Viewer list?

Hello,

I want the user to be able to click one of the options in a Data Viewer List, which then sends him further down into the data structure tree.

I am using a restaurant menu as an example. The top level is a list of meal types, like Entrée, main, soups, breads, drinks etc.

Of course, when clicking Drinks, i want to navigate the next level data, containing a list of drinks like; Beer, Wine, Soda, Coffe etc.

Then again, the user clicks on Beer, now the next level data will show a list like; Heineken, Budweiser, Carlsberg etc.

And so on. The last datalayer would probably have a + button icon, so you can add the item to your order.

I’m having a little succes, but to be honest, i sincerely believe there to be a better way, but my limited knowledge of the thunkable blocks is messing with me.

For the record, I’ve got a CS and a Marine Engineering degree, and write code on a daily basis at my dayjob as an industrial engineer. I’ve used Function Block and Ladder programming as well, so I understand at least the basic terminology, i’ve just never used anything like Thunkables blocks before :slight_smile:

On a side note,why are the row_id in the data viewer list some long string, instead of giving and index as an int or something?

1 Like

Welcome to block coding. There is a limitation in Thunkable Data Viewer List/Grid that there is no block to change the data source of the list therefore the simplest way around it is actually putting number of Data Viewer Lists in your screen and have the top level one shown and the others hidden (set visible property to false).

Based in the user selection you will then show the appropriate list and so on.

Going this way, your data should be organised in different tables to match the solution.

The row_id of the Data Viewer List is the unique ID of the row (record) in the table which you can use to execute and row related functions such as Updating the contents or copying the info to another table or component.

Happy Thunking

2 Likes

Yes, this is the way I tried to do it already, i was just wondering if there was perhaps a better way, like you mentioned, to switch the datasource of the list.

I will move forward with my initial design then!

1 Like

Yes there is a programatic way by having a table with all the data and another empty table that you dynamically fill with items based on the choice of the master list.

See this sample project

https://x.thunkable.com/projectPage/5fb9fb1dbfeb240011084d78