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 /

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

Sort ComplexTableField in the CMS


Go to End
Reply


2 Posts   2201 Views

Avatar
knsqnt

Community Member, 95 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, 95 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'
);