How to handle one-to-many relationships

Tags: #<Tag:0x00007fee33fd3f30>

I’m looking for the best (any?) way to handle one-to-many relationships in a table using data binding. See the image below for an example, where each (full) row is a user, and a user may have 0 or more ‘roles’ assigned (possibly a minimum of 1).

image

My first thought was to use a multi-select cell type, but that doesn’t seem to exist yet, and the few existing user-created solutions I found were outdated and non-functional for my environment. I know there’s cell merging functionality available, but I don’t see how that would work with data binding - or at least not without a ton of extra work. Is there any existing quick and easy solution for what I need?

Hi @samual.finnigan

Using mergeCells functionality is what came to my mind at first also, but as you mentioned it might be problematic with data binding. Unfortunately, we don’t have any easy-to-go solution for that kind of problem, so the custom solution might be the only way here at the moment.

What about constructing a custom context menu option called “attach a role” and then add a new role to the existing one within the same cell.

Mockup

03

16

Menu structure: http://jsfiddle.net/m9tz3hLv/2/

Hi @samual.finnigan how is the project going? Did you already solve the parts with roles?

I have to post under a new account as my workplace changed the login details on the other for security reasons, but we ended up going a different direction with this piece. I’m sure I could’ve figured out a solution with either text processing as you suggested, or a custom renderer with a bit more work if needed. Your help is much appreciated.

Thank you for the update @sfinnigan