This is a migrated thread and some comments may be shown as answers.
Does treelist support multiple-to-multiple relations between parent and children?
4 Answers 32 Views
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 02 Jan 2020, 09:40 AM

Hi,

Currently we have data that 1 parent can have multiple children meanwhile a child can belongs to multiple parents. Does treelist support this scenario?

Per what we see now the child will be placed under only 1 parent (maybe the 1st one) but other parents don't have this child available.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 03 Jan 2020, 01:46 PM

Hello Randy,

Currently the TreeList allows only one parent field to be specified.

e.g.

                        schema: {
                            model: {
                                id: "EmployeeID",
                                parentId: "ReportsTo",
                             ...

One way to display one child within multiple parents would be to duplicate the item on the client and adjust its parent id field. Is that an option for you?

Regards,
Georgi
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Randy
Top achievements
Rank 1
answered on 06 Jan 2020, 03:08 AM

Hi Georgi,

Thank you for replying.

Unfortunately duplicating child records does not help on my situation. I may not explained my issue clearly. I created a demo here:

https://dojo.telerik.com/IZoSimav

Pls not there are two records of {id: 60, Name: "Akeem Carr"}, while with different parent ids. No matter what the parent id of the second record is, those two records will both be placed under the parent node with 1st parent id. In the example they are both under {id: 11, Name: "Hyacinth Hood"}. And the actual parent of second child, {id: 42, Name: "Gage Daniels"}, has the expander icon but with no child attached. We observed same behavior in our project.

Could you suggest more?

0
Randy
Top achievements
Rank 1
answered on 07 Jan 2020, 03:33 AM

Hi Georgi,

As a second attempt, after changing the duplicate "Akeem Carr" record with different ids, the treelist displays the parent and children as expected. I think we can start from here by updating our logic to suit this requirement. Thank you for the hint.

0
Georgi
Telerik team
answered on 07 Jan 2020, 01:04 PM

Hi Randy,

That is correct, the ids of the items must be unique as they are used by the dataSource to track the models. Nevertheless, I am happy to hear that this works for you.

Regards,
Georgi
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Randy
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Randy
Top achievements
Rank 1
Share this question
or