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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

I want to sort data at CMS


Go to End


3 Posts   895 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, 1391 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.