rhwilr/vue-nestable

parentProp as an alternative to childrenProp

mariusa opened this issue · 2 comments

Hi,

The current way to organize items a tree requires storing a nested array. That's hard to store in a database. Would you please also support having items in a flat array, with a parent_id property?

That could be specified in parentProp, as an alternative to childrenProp:

nestableItems: [
        {
          id: 0,
          text: 'Andy'
        }, {
          id: 1,
          text: 'Harry',
        }, {
            id: 2,
            text: 'David',
            parent_id: 1,
        }, {
          id: 3,
          text: 'Lisa'
        }
      ]

Hi @mariusa
You should use a mapper function to transform your data to the structure vue-nestable expects.
We will not support different data structure, as each project has different requirements. We would have to support many data structures, which increases the maintenance for the project.

Ok, thanks for considering.