Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Arbitrary Sort in tablefield

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1045 Views
  • UncleCheese
    Avatar
    4085 Posts

    Arbitrary Sort in tablefield Link to this post

    I know TableFields don't support drag-and-drop re-ordering. That would be awesome! (next version, please?)

    But until then, I want to add an arbitrary "Sort" field to my DataObjects in a TableField or CTF. Problem is, I'm not sure how to cascade an update if the user assigns a new sort order to an object that is already taken by another object. Don't want to end up with two 3's, for instance.

    Anyone have any idea how to do that? I assume this is where onBeforeWrite() is handy, but that's just a guess.

    The problem I'm having is making the distinction between the data supplied by the form and the data that was already on the object to begin with.

    $this->Sort .. is that the old data or the new data coming in from the form?

    Maybe $_POST['Sort'] is what I want?

    Also, writing an efficient query seems like another chore. Any ideas?

    1045 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.