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.

Customising the CMS /

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

Sorting in Filetree / TreeDropdownField


Go to End


2 Posts   1710 Views

Avatar
woehning

Community Member, 1 Post

21 August 2010 at 4:52am

Hi folks,

we wonder if it's possible to sort the files and folders in the Dropdownfield to apply existing files/folders to a page. They're currently sorted by ID / upload date and it's quite annoying to look for files if the folder is really crowded.

Thanks for help!
Lars

Avatar
Puppy

Community Member, 10 Posts

31 August 2010 at 1:08am

I am not completely sure what you are trying to acheive but you will need to change how you would like the $array of directories to be displayed before setting the DropdownField.


$array = \\Organised the order of your array

$field = new DropdownField(
  'Example',
  'Example',
  $array
);

Hope this is a starting place for you.

2 Sources

http://doc.silverstripe.org/dropdownfield

http://api.silverstripe.org/2.4/forms/fields-basic/DropdownField.html