admin icon indicating copy to clipboard operation
admin copied to clipboard

create hierarchical tree of categories and display tree in select box

Open ghost opened this issue 5 years ago • 3 comments

Hi,

Hope you are all well !

Is it possible to give an example of how to create a hierarchical tree of categories ?

I tried qor-example and it is not showing the parent category in the select box. It would be really convenient for similar category labels.

Cheers, X

ghost avatar Jul 24 '20 05:07 ghost

hi @x0rzkov

"categories" you mean in the select_one or select_many component?

raven-chen avatar Jul 24 '20 09:07 raven-chen

Hi @raven-chen ,

thanks for the reply !

This piece of code is not working when you are trying to create a tree of category https://github.com/qor/qor-example/blob/master/models/products/category.go

I tried to re-implement it on a separate qor-admin instance and each time I save a new category with a parent category, it deletes other relationships (for other categories I created).

And from your code, https://github.com/qor/qor-example/blob/master/app/products/products.go#L57, it is select_many component.

Thanks for your next reply, as I need to sort it out quickly either they will kick my ass ^^

ghost avatar Jul 24 '20 09:07 ghost

Hi guys, @raven-chen

I think that I understand what he means.

Something like that: nestedset

Refs:

  • https://github.com/griffinqiu/go-nested-set (gorm v2)
  • https://github.com/vcraescu/gorm-nested (gorm v1)

That would be awesome to add such panel to browse items/products.

Do you think that the qor dev team can do that easily ?

Thanks for any insights or inputs on that

Cheers, Luc Michalski

ghost avatar Jan 15 '21 06:01 ghost