Is it possible to have two arrays in each object, like so:
[
{
"id": 1,
"title": "Drink",
"subcategories": [
{
"id": 11,
"title": "Alcoholic",
"subcategories": [
{
"id": 111,
"title": "Margarita",
"subcategories": [],
"products": []
},
],
"products": [
{
"id": 12,
"title": "Budweiser"
}
]
}
],
"products": [
{
"id": 2,
"title": "Coca Cola"
}
]
}
]
Here you have two arrays, subcategories and products, in each object. Instead of just the nodes array found in the examples:
{
'id': 1,
'title': 'node1',
'nodes': [
{
'id': 11,
'title': 'node1.1',
'nodes': [
{
'id': 111,
'title': 'node1.1.1',
'nodes': []
}
]
},
{
'id': 12,
'title': 'node1.2',
'nodes': []
}
]
}......
When using the UI Tree drag and drop, if I drag products contents into a parent category then how will it know to fill the products array and not the subcategories array. I'm not sure how to specify this during the drag and drop. Adding a new item is easy because I can just push to the selected array, but I do not see how the drag and drop would know which to push to. Sorry if I have been unclear. Let me know if I need to explain more. Thanks.
subcategoriesandproductscould certainly hold data, but they are not nodes. You wouldn't be able to move nodes from other areas into those arrays.subcategoriescould have children...which could beproductsor moresubcategories, butproductsare not allowed children