Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

save the order of a ListboxField or work around


Go to End


5 Posts   982 Views

Avatar
mi32dogs

Community Member, 75 Posts

9 December 2016 at 10:55am

Hi

I have a databoject with Sponsors, now in a project dataobject where you can select the sponsors for that project via a ListboxField, this works great but it does not keep the order that the Sponsors where selected what is necessary as they must be ordered in order of sponsor amount.

Is there a way to save the order of a ListboxField or is there another way to accomplish this?

Avatar
martimiz

Forum Moderator, 1391 Posts

10 December 2016 at 8:49am

Edited: 10/12/2016 8:50am

I remember running into this a while back, and I did some research, but I can't really remember if I fixed it then, but I may still have some notes somewhere. I'd have to look for them though... Point is the javascript plugin this field is based on doesn't respect the sortorder of the elements, even if there is one.

So unless someone else knows more...

Avatar
mi32dogs

Community Member, 75 Posts

10 December 2016 at 11:19am

Thanks, Do you know of a other way to accomplish this? not with a Listfield box but with a other field type?

Avatar
martimiz

Forum Moderator, 1391 Posts

10 December 2016 at 11:38am

Maybe this one? It supports has_many, many_many, and sorting...

https://github.com/briceburg/silverstripe-pickerfield

Avatar
mi32dogs

Community Member, 75 Posts

10 December 2016 at 11:42am

THANKS, I will give it a go