dipson88 / treeselectjs

Treeselect on vanilla JS
MIT License
83 stars 15 forks source link

Two children with same name and value to different parrents bug #50

Open makatsis opened 1 year ago

makatsis commented 1 year ago

Suppose that we have the following tree const categoriesOptions = [ { name: 'Non-residential', value: 'Non-residential', children: [ { name: 'Education', value: 'Education', children: [] }, { name: 'N/A', value: 'N/A', children: [] } ] }, { name: 'Residential', value: 'Residential', children: [ { name: 'Apartment blocks', value: 'Apartment blocks', children: [] }, { name: 'N/A', value: 'N/A', children: [] } ] } ]

The library is not working because the parents (Non-residential, Residential) has to children with the same name and value. Is there a way to be fixed, without changing the name and the value?

Thank you!

dipson88 commented 1 year ago

Hi @makatsis, now it is not possible. The value should be unique for every value, but you can use the same name. I can suggest creating a mapper and mapping your values with diff ids - and after selecting remap value to the traditional value that you need.