Dynamic table columns

is it possible in bubble to have a table function like this?

Sequence 01

basically i want users to be able to “build” their own custom spreadsheet by using the dropdown to select the field value which will intern populate the corresponding data below, and then either a new blank column appears to the right to continue adding more columns or a + sign to add another column.

the datatype its pulling from has 50+ columns which is why i don’t want to display all of it and sometimes users only need 3 columns or 5 columns etc, so i want them to be able to “build” the spreadsheet selecting only the columns they want to see.

1 Like

Yes, you can separate the header from the repeating group and add a plus icon to show more columns. Attach a focus group that allows the user to select which field they want to add here. and display that field in the new column.

how do you actually reveal columns though?

so it has to be an RG not a table? will all the rows still match up across columns?

Create a repeating group with all the content available, hide all columns except one.
Keep the header of the table outside of the repeating group. you can run an action on the header to add a column and just show that field in the repeating group.

This is how you can do it with RGs.

I haven’t worked with table elements that much so I’m not too sure about it

i understand the theory but i dont see the button/options for it, by hide all columns do you mean set columns to 1? what action adds an additional column? i cant see how you dynamically control columns

Hey @rob26 :wave:

I wanted to see the limitations of the table element so I have created a simple demo. You can simply setup all columns, make them invisible, and then, you can keep track of the visible ones with a custom state. Then, your dropdown will just add to this custom state and a button in each column will remove from this custom state. See the demo below:
brave_vyYApkqxBz

Here are the technical details:

Each column is still there and setup:

But they are invisible at first:

You can keep track of the open ones in a custom state:

And change the visibility of the column conditionally:

And the last column will have the dropdown to show available columns (invisible ones). It is basically all columns except visible ones:

Here is the editor if you want to check the details: Bubble Demos by Flusk | Bubble Editor

I hope this helps.

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

You need this, the table element is trash:

1 Like

ah i see, i was looking at it the wrong way creating a blank table to add to, rather than build a hidden template and reveal each column with custom states. ill give this a try!

what specifically makes it bad? i’ve seen people say its bad but why? is it just for a specific use its bad or something else?

Anything you want to do in a table you can do in a repeating group, not everything you want to do in a repeating group you can do in a table. Table useful for a very narrow set of cases.

So one issue i noticed when i tried your demo, the columns will only be in the order you set, i want the columns to appear in the position the user selects, for instance if you chose age for the first column and name for the second, it will switch them around because it simply revealing them. i think this is why i was basing my approach on an emtpy template

I guess it is not possible with table but repeating group has more flexibility for this case as @georgecollier mentioned. Still it is not straightforward because I could do it with string manipulation. But if it helps, see the demo below in the same editor:
brave_BPyllOJi5x

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

i figured out one simple way to do it, its not perfect as removing columns doesn’t work quite right but at least building and changing works.

i created a table and each column header has a dropdown to choose the field value, i then hid all column except the first and then from column B onwards i had a condition to look at the column to the left, and if the dropdown is not empty then this element is visible.

however, i now realise i cant make the initial content dynamic, i have to select a field when using Current Row’s… i cant do Current Row filtered by… so im not sure if my original idea is possible anyway. looking at RGs instead now but still not sure this is possible

This topic was automatically closed after 70 days. New replies are no longer allowed.