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.

Data Model Questions /

Sort ComplexTableField in the CMS


Reply


2 Posts   2018 Views

Avatar
knsqnt

Community Member, 85 Posts

22 June 2009 at 2:41am

Edited: 22/06/2009 9:35am

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!

Avatar
knsqnt

Community Member, 85 Posts

22 June 2009 at 9:34am

Edited: 22/06/2009 9:34am

Ahhh, that's how it works:

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