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.

Customising the CMS /

Sorting in Filetree / TreeDropdownField


Reply


2 Posts   1106 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