poirazis / bb-component-SuperTable

A modular Table component for Budibase.
23 stars 8 forks source link

How to access super-table columns values #8

Closed seoulaja closed 1 year ago

seoulaja commented 1 year ago

Hi @poirazis

Firstly, I would like to say thank you for your great plugins for @budibase. They are very useful and handy for my work!!

I have a question, in super table how I can access other column/cell value?

The case is when I click a "Settings" button on super table it would navigate to other pages which has 2 URL Parameters. This parameter got the value from the data of the table.

Regards, Seoul

poirazis commented 1 year ago

Hey @seoulaja and thank you for your kind words ! You can put components ( any budibase component ) inside the SuperTableColumn and you can then bind to the Cell Value. In your case you can drop a Button / Icon / Link and use the cell value / row id bindings exposed by the Super Table Column to pass on as parameters

hope this helps !

seoulaja commented 1 year ago

Hi @poirazis,

Thank you for your quick response.

Yes, I did as you suggested. I put a button and bind it to the cell value. The problem was I want to access other cell values, so when I click the button it will navigate to another page with 2 parameters in it.

I can do that with a basic table from Budibase, by calling the table component and then I can see a list of available value I can select, see below

image

In super table I can only get the value of the cell where the component is in it.

Cheers,

poirazis commented 1 year ago

Hey @seoulaja

You can use the Row ID to grab any column value from the wrapping dataprovider. Exposing full row data to each cell would be a performance issue as each super column is a district component.

Hope this helps !

seoulaja commented 1 year ago

Hi @poirazis

Thank you! It works!

For the benefit of other users, here is the solution for me:

const a = $("Data Provider.Rows").filter(x => x.ProposalId === $("Settings.Row ID"));
const projectGroupId = helpers.pluck(a,'ProjectGroupId');
return '/proposal-settings/'+$("Settings.Cell Value")+'/'+projectGroupId;

cheers