Jump to content

Reorder repeater items via API


Adam Kiss
 Share

Recommended Posts

Hm, not only it does not help, I'm now even more confused. It seems that I could call something like $page->repeater->sort('value'), when exporting it, but… that doesn't work. (I realized that I can use sorting as well, don't need reordering)

Bah. I hope Ryan/Soma/Kongondo will notice this. :)

Link to comment
Share on other sites

Hm, not only it does not help, I'm now even more confused. It seems that I could call something like $page->repeater->sort('value'), when exporting it, but… that doesn't work. (I realized that I can use sorting as well, don't need reordering)

Bah. I hope Ryan/Soma/Kongondo will notice this. :)

Wow! Adam has put me in privileged company!!?! My two minutes of fame :D. I couldn't code my way out of a brown paper bag if I was put in one! Hehe. Sorry, your query is way above my pay grade.... ;)

  • Like 1
Link to comment
Share on other sites

@Horst - it is more of my limited brainpower in this tropical heat, you've linked me to good content though. Thanks.

@Kongondo - you're such a disappointment.  :D

---

On a more serious note, ->sort() works. But you can enter just one repeater field (not multiple, as I've tried, although that seems to be in the works, as @Ryan noted in the code ;) ), and the field must exist (yeah, that one's on me).

  • Like 2
Link to comment
Share on other sites

On a more serious note, ->sort() works. But you can enter just one repeater field (not multiple, as I've tried, although that seems to be in the works, as @Ryan noted in the code  ;) ), and the field must exist (yeah, that one's on me).

What version of ProcessWire are you using? 2.3 and newer (at least) should supporting sorting by multiple fields in WireArray / PageArray. 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...