Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

1148 Posts in 322 Topics by 272 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Sort ComplexTableField in the CMS

Page: 1
Go to End
Author Topic: Sort ComplexTableField in the CMS 457 Views
  • Germaniac
    avatar
    Community Member
    25 posts

    Sort ComplexTableField in the CMS Link to this post

    Hi,

    I've got a simple news section made with DataObjects. Everything works fine, I just want to sort the entries by date.

    $newsTable = new ComplexTableField(
       $this,
       'NewsArticles',
       'NewsArticle',
       array(
          'ArticleDate' => 'Article Date',
          'ArticleTitle' => 'Article Title'
       ),
       null
    );

    Can anyone give me a hint? Thanks!

  • Germaniac
    avatar
    Community Member
    25 posts

    Re: Sort ComplexTableField in the CMS Link to this post

    Ahhh, that's how it works:

    $newsTable = new ComplexTableField(
       $this,
       'NewsArticles',
       'NewsArticle',
       array(
          'ArticleDate' => 'Article Date',
          'ArticleTitle' => 'Article Title'
       ),
       null,
       null,
       'ArticleDate DESC'
    );

    457 Views
Page: 1
Go to Top

Currently Online: mtz, Euphemismus, stx333

Welcome to our latest member: mr-andrew

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.