Can I make data grid column names (and amount) dinamically?

In my app I have a “type” table (cash, paypal, zelle, wire transfer, check, and so on).
I also have a “payment method” table. Each payment method is related to a type:
John’s paypal - Paypal
Cash in USD - Cash
Cash in CAD - Cash
(basically a 1 → n relation, each type can have multiple payment methods)

all of these payment methods are linked to an user:
By example:
John:

  • he accepts “Cash in USD”
  • he accepts “Paypal to @John

Karen:

  • she accepts “Cash in USD”
  • she accepts “Wire Transfers”
  • she accepts “Zelle to @Karen

Now, what I want is a data grid in which each column name is the payment methods that the user that is currently seeing the page accepts. Meaning, the names and amount of columns won’t be the same for two users:

Is this possible to achieve in Glide?

Hi,
you can obtain something similar, for example.
The main drawback with this representation is that the number of columns is static. So it has to be sized correctly, and it’s impossible to hide empty columns.


Thanks!

But what would you show when you have those “dynamic” column names? Would each row represent a transaction?

I will have multiple rows, one for each month of the year.
Below the payment methods, will have a rollup for how much money entered in each month to that payment method

Got it, that makes sense. I was thinking you can somehow:

  • Create a table that stores the transactions (user id, method, amount).
  • Create a JSON structure in the users table that combines all of the relevant transactions.
  • Use JavaScript to construct a HTML table to display the sums for each month.

That might give you a much more flexible option to work with rather than the data grid component.

1 Like