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

I want to sort data at CMS


Go to End


3 Posts   1475 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.