Mackski Posted September 6, 2018 Share Posted September 6, 2018 I have a strange problem with repeaters, the markup for sort order is rendered correctly, as is the repeater list and markup: eg: <input id="sort_repeater73338" class="InputfieldRepeaterSort" name="sort_repeater73338" value="0" type="hidden"> <input id="sort_repeater73322" class="InputfieldRepeaterSort" name="sort_repeater73322" value="1" type="hidden"> After saving, there is no change in the sort order in the DB. Every repeater with the same parent has the same sort order, no matter what. This happens at the time of created via the API, I am explicitly setting the sort order here: $rep = $p->draw_nomination_repeater->getNew(); $rep->page_link = $array['id']; $rep->sort = $x++; $p->draw_nomination_repeater->add($rep); $p->of(false); $p->save(); Could the sort change not be detected when creating multiple repeaters via the API? if($page->isChanged('sort')) { // $this->message("Sort changed for field {$this->field} page {$page->id}", Notice::debug); $sortChanged = true; } Link to comment Share on other sites More sharing options...
Robin S Posted September 7, 2018 Share Posted September 7, 2018 First thing would be to use Tracy to check what the value of $x is when you create your repeater pages. Your post doesn't show where this variable is declared - maybe it is being reset within your loop or isn't incrementing as expected for some other reason. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now