-
☆ A M B ☆
- 24,524 Posts
I'm not sure if Wayfinder can order by a TV. pdoMenu can.
Hi Susan,
I'm not going to use it with wayfinder. I'll write my own snippet to build the menus.
I just don't know how to make a TV that re-orders across all resources that have it, exactly like menu-index does.
RDG
[ed. note: rdaneeel last edited this post 11 years, 4 months ago.]
Is there some reason you don't want to just use the existing menuindex field? I don't see the point of having a TV that's going to be renumbered all the time. Using the menuindex field will make for *much* faster menus and renumbering it will also be faster. The values will persist as long as you don't drag resources in the tree.
Hi BobRay,
Oh I do use the menuindex for the regular menu. but i use several kinds of menus for different collections. So a resource can be listed in several menu's. I'm looking for a way to give resources multiple menu-indices.
RDG
-
☆ A M B ☆
- 24,524 Posts
You might be able to do something with a MIGX grid. You can get the raw JSON and process it yourself, or you might be able to use migxLoopCollection.
[ed. note: sottwell last edited this post 11 years, 4 months ago.]
It's not difficult to set the TV values. The difficult part is selecting the resources you want to renumber them for, and creating an algorithm to renumber them. You haven't said how you want them ordered -- they have to be renumbered by some characteristic of the resource unless you want them in random order. The menuindex field is ordered by the resource's position in the tree, but you must not want that or you'd just use the menuindex.
-
☆ A M B ☆
- 24,524 Posts
And that's why I was thinking of a MIGX grid. You can populate a grid using some code to list a specified set of resources - those with a parent of xyz, or those using a specified template. Then you can position them in the grid by dragging-and-dropping, and using the resulting TV value (JSON) to display the resources in the desired order.
Is there anything you can't do with MIGX?

That sounds like a great solution.
Hi,
what i want is a TV on each resource called 'top10' . when my client takes a resource and fills in the input field for 'top10'
lets say they change rank from 2 to 5, i want the rank for the resource that has 'top10' =5 to change to 4 , resource with 'top 10'=4 to 3 etc. when i save the resource.
I don't see how this could be done with with MIGX?
I was thinking of doing this with a plug in that onBeforeDocFormSave grabs all resources with TV 'top10'
then checks the old value for the TV
then shift all values according to the new value for the TV
then save all resources and then go on to onDocFormSave.
BUt i have no idea how to even start doing this
RDG