I need help in achieving a particular functionality


So let me explain what I'm trying to achieve here. In the image, you can see that there are categories and subcategories. where each category has a confined set of subcategories and, In the format of tags. In the data, each of the rows only consists of a single selected subcategory. I need the table to show me the set of subcategories as a dropdown based on what the category is when clicked on it. While the table should normally show the selected subcategory. This is where I've been struggling I've been able to get only half done. if I get the options right I'm not able to display it. If I display the data in database in the table I'm not able to show options. So I'm in a learning stage so please bare with me. I'm also uploading a couple of screenshots just in case.



Screenshot 2023-07-24 at 3.32.12 PM
Screenshot 2023-07-24 at 3.32.43 PM

Can you post sample data from cat_sub_Cat_State?

[
{
"name": "ads",
"subCat": ["adwords", "facebook", "google_ads"]
},
{
"name": "amazon",
"subCat": ["amazon_internet"]
},
.
.
.
]

But I want to achieve this within the table. for reference let me attach the link in the documentation.

If you scroll down into the editable cells section's table you can notice a column named tags. That's what I'm looking to achieve with the subCategory column.

Yes and so make the column editable:

This is where I've been struggling I need it to show only specific subcategory options on the basis of the category specified in the column before. please refer to the state I've written. So, this is what I want. I need the table to show the data that is mentioned in the database and I want it to show the specific subCategory data when clicked on. I want it to show the data on the table even when the particular row isn't clicked on. Please help me achieve this. Knowing and understanding this in. depth means a lot to my work. Thank you for bearing all my questions

If you are using a Legacy table, a dropdown/select type component in a column is not possible. Only tags are available.
Screenshot 2023-07-27 at 8.35.17 AM

No, I'm using a new table.

@Kabirdas @Tess or really anyone else...
Met with Sai, and here is what it comes down to...
The Category column is changed, the Sub category column should have it's cell's value replaced in the same row where the Category has now changed.... seems that the originally selected value in the Sub Category column never gets removed:


Using a Legacy table, as the new Table is something I don't want to tackle until we can resolved this issue first...

Bump

1 Like

Hi there!

Hmm, this isn't necessarily a use case that I've worked on before, but I think you could accomplish this with a custom column.

I'm including an app export of where I've tried this out. It is using dummy data, so it would have to be modified a bit for a real use case.

If you type a different value into the Name column & then click out of the cell, you should see Column 4 change. I've left the subCat column that comes from the table data there even though it isn't dynamic

This is the code for the custom column

{{  [
{id: 2,
"name": "ads",
"subCat": ["adwords", "facebook", "google_ads"]
},{id: 3,
"name": "another",
"subCat": ["other", "another one"]
},
{id: 1,
"name": "amazon",
"subCat": ["amazon_internet"]
}
].filter(x=> self.changesetArray.filter(x=>x.id ===currentSourceRow.id).length>0? x.name=== self.changesetArray.filter(x=>x.id ===currentSourceRow.id)[0].name: x.name ===  currentSourceRow.name)[0].subCat  }}
1 Like

App export
table-20dynamic.json

Thank You @Tess,
Could you Please have a look at this.
I keep getting undefined after at the end of the tag dropdown

1 Like