I have a requirement to create a table column that displays multiple tags for each entry. The column should show at least five tags, and if there are more, they should be shortened with an additional tag (e.g., "+7 …"). This "+7" tag should be clickable to open a modal menu. Also multi-select filters would be a helpful addition.
Would storing tag text as a comma-separated string in the database be a good approach for generating such a column? Or is there a better way to structure the data for optimal performance and flexibility? Any suggestions would be appreciated!
Hello @Karthik Santosh
To make collaboration more efficient, please share a sample oml with your use case so the community members don't need to invest extra time trying to replicate it as well as what have you tried so far.
Cheers,GM
Hi @Gonçalo MartinsUnfortunately, I do not have the liberty to share the .oml file since it's a client-owned file and I haven’t had the chance to test it in a personal environment yet. Apologies for the inconvenience caused, though it would be of great help if explained through words as well!Thank you!
Hi,
Actually storing tags as a comma-separated string in the database may seem like a immediate solution, but it have lot of limitations because searching, filtering, and managing tags much harder as the data grows.
A better approach is to structure the data using a many-to-many relationship with a separate Tags table. if you add as many-to-many relationship it makes faster searches and filtering without messy string operations and makes it easier to manage and update individual the tags. It supports efficient multi-select filters for users to refine their search.
For your UI requirements (showing the first 5 tags and a +X more expandable option), you can fetch the first 5 tags and dynamically load the rest when clicked. You can have table like
This may help your issue.
Thanks,
Sriyamini J
Hi @SriyaminiThank you for the explanation. Your approach makes sense, and I can see how it improves search and filtering efficiency.
Could you kindly elaborate on the details on how to implement this? Specifically, how to create, store, and retrieve tags using this structure in Datagrid? We can use dropdown tags in a regular table, but how can we implement them in a Datagrid?
Hi @Karthik Santosh ,
Should this column be read-only?
Hi @Mihai MelencuIt should have a functionality where clicking on it opens a modal, allowing users to add more tags by selecting text in the modal. So, I assume it would be Read-Write.
Here are some posts from the Wijmo forum related to multi-selection that can help you get started with your use case:
And two samples: