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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

ModelAdmin sorting & relationships


Reply


3 Posts   834 Views

Avatar
kinglozzer

Community Member, 171 Posts

16 August 2012 at 3:48am

Hi guys,

Testing out SS3, have been building a news section from scratch.

Each news article 'has_one' author, and author name is being displayed as a summary field. I would like to be able to have the option of sorting by author name by clicking on the table header, like I can with date/title.

Is this possible? Or have I set my relationships up wrong or something?

Thanks,
Lawrence

Avatar
DesignerX.com.au

Community Member, 107 Posts

17 August 2012 at 11:20pm

Hi:
I need this feature too, by default it allow ID column to be sorted but not all of the other columns , IF you have a look at the Security section-> member table ,you notice that you can sort by E-mail, First name or last name .. so maybe if we find the correct .php files we can find a good example ;)

let me know if you find anything, I also will be looking into it in my free time

Avatar
camfindlay

Forum Moderator, 181 Posts

19 August 2012 at 8:53am

www.ssbits.com/tutorials/2011/sorting-on-a-related-dataobject-in-modeladmin/

That might help out, I think it is aimed at 2.4 but could perhaps be adapted for ss3