Is there a way to have a different Tag List for each Table Row based on another column

I have a Tag column on this table. I want to be able to have different options for each row depending on the record type.

For instance if I have a row that has a category column value of Produce, I want the source column to have the options of ["Farmer Direct", "Distributor", "Other"], but if the category is Meat I want the source column to have the options of ["Local Butcher", "Packing Plant", "Other"].

I tried this:

{{ qryStatsConfig.data.find(el => el.category_key === tblStatDetails.selectedSourceRow.category_key ).options}}

But it only tests the first table row and applies that array to every other row.

I can't seem to find a perfect way to have this work, however I did think of an alternative - You could make a JS Transformer that did the work for you, e.g.

return data.map((item) => ({
  ...item,
  source: qryStatsConfig.data.find(el => el.category_key === item.category_key ).options
});

Whilst it's not perfect, it could be a way to get around it!

Hope this helps!

1 Like

That sort of works and my originally idea also sort of works (once I fixed a bug in it.)

But the options keep changing and clearing in the table - it's hard to describe.

Fait to say, the table was not designed to accommodate this.

1 Like

Hi @bradlymathews agreed that it wasn't designed for this use case, at least not yet. It wasn't implemented initially for performance reasons. We have a feature request for this, so I'll add a +1

I have also struggled to find a good solution for this, but the recommendation is to use expandable rows with nested Select components.

1 Like

+1 from me too on the feature request.

I have a very simple table that I was hoping not to clutter up with expandable rows and additional components. Would be nice to have the ability to restrict the mapped options for a tag in a simpler way.