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 /

I want to sort data at CMS


Reply


3 Posts   533 Views

Avatar
leafchild

Community Member, 41 Posts

11 October 2011 at 2:56pm

I used this page as sample:
http://doc.silverstripe.org/sapphire/en/tutorials/5-dataobject-relationship-managementhttp://doc.silverstripe.org/sapphire/en/tutorials/5-dataobject-relationship-managementhttp://doc.silverstripe.org/sapphire/en/tutorials/5-dataobject-relationship-management

So I created like pop-up window and adding students.
The everything works fine. I can add students and I can list them.

The student list order show oldest to newest by adding order.
I wish that I can sort student by name at CMS.

Is this possible?

Avatar
martimiz

Forum Moderator, 1097 Posts

11 October 2011 at 11:51pm

There is a 7th parameter $sourceSort for the (HasMany)ComplexTableField - so this might work (based on the code from the tutorial):

$tablefield = new HasOneComplexTableField(
$this,
'MyStudent',
'Student',
array(
'FirstName' => 'First Name',
'Lastname' => 'Family Name',
'Nationality' => 'Nationality'
),
'getCMSFields_forPopup',
null,
'Lastname'
);

Avatar
leafchild

Community Member, 41 Posts

12 October 2011 at 1:45am

Thanks martimiz.
It's working.