KeyValue not saving new order
Hopefully someone has an idea where I'm going wrong - I have this inside a repeater:
but when I save it reverts to the old order?
8 Replies
Do the options relation have the order column? does the DB ever get updated?
I would tend to use telescope and monitor the request
It's not a relation, it's the same table just another field. I'll have a look at the request!
I'm a little confused how options.select_options work usually this would mean options is a relationship...
Yea I probably should have done that - this is in a modal and I have a field called options I'm submitting to - this is my full code for this repeater:
I am guessing it's to do with your action method, try DDing and seeing if you get it correctly
@toeknee sorry! Just getting back to this - I did get the dd of $state to output the correct values and working correctly, but when I save it will save in alphabetical order?
The order could be reset by PHP, JS or your database, object order is never really guaranteed, only array items with numeric keys
Yea that's what I'm thinking - I have it cast as an array as well and state comes through correctly so it could be the db
yea... it's the db 😦 all good thanks for pointing me in the right direction!
easy fix at least!
Just in case someone has the same issue - I realised I had a typo and the type of the field in the db was set to jsonb instead of json