I know v6 has tagify sorting in it (drag and drop) but I have data in a table which has sort order values and so I want to process them in the set order rather than the order they put them into the tagify field or the order they’ve dragged them into.
Eg. Data is: id, productname, sortorder
1, Product 1, 10
2, Product 2, 20
3, Product 3, 30
Then they fill the tagify field with:
Product 3, Product 1, Product 2
I want the SC actions to store them in the JSON field as [1,2,3]
What’s the process to achieve this? I’ve tried creating an array and repeating through the posted values and populating that array. Then sorting the array by the sortorder field. But I can’t see how I get the new array values into the JSON field in my database.
If I understand right, you want the JSON to be rearranged depending on the sortorder of the items that exist in the tagify no matter the order that the have been placed from the user…
Is that right?
The order of the items is already determined in the database. They will add them into the tagify field in whatever order they choose but ultimately they need to be stored in the order set by the data.
How you handle the data at the moment on serverside?
I would like to test it but it would be better if I have something to work on specific…
A screenshot of this part of your serveraction maybe
This is what I’ve done so far. It all seems logical and should work but I just can’t see how I get the finished array into the JSON field in the database.
You are an absolute diamond @famousmag. It looks like the bit I was missing was how you set the ‘Set Value’ of {{sortedCats.flatten('catid')}} which I assume has to be hand-coded as I wasn’t able to select sortedCat in order to then format it.
Will give it a go now.
Massive thanks again. Wonderful description and screenshots.