7938 Posts in 1541 Topics by 945 members
|Go to End|
21 August 2009 at 5:00am Last edited: 21 August 2009 9:48pm
Ok, so this should be my last question for today!
I've managed to implement a relationship along with the DOM, but can't work out how to display the relationship in the admin page.
I've got a NewsArticle object with four fields: Date, Author, News content, and Category.
The Category is connected through a one -> many relationship (each article can have one category, category can have many articles).
I've got the DOM to display just the Category ID that's been assigned to the NewsArticle object - but would like to display (and filter by category).
Here's my code: http://pastie.org/590006
Does anyone know what I need to do to get it working?
Is there something basic I'm missing, or need to understand how the headers array can accept data?
All help is much appreciated!
21 August 2009 at 5:16am
In your headings array, you should be able to do:
array('NewsCategory.Title' => 'News category title');
But if that doesn't work, just use a custom getter.
array('NewsCategoryTitle' => 'News category title');
21 August 2009 at 5:21am
Hi Uncle Cheese,
I feel like a bit of a dolt this afternoon, but how do I implement a custom getter?
Does that need to be put in the header array, inside the getCMSFields function, or made as a function of its own in some way?
I tried NewsContent.Title, and it just returned the id with a hash (pound) symbol in front of it...
21 August 2009 at 5:38am
You put the custom getter in the model for the class you're viewing in the DOM. In your case, that's NewsArticle, I believe.
21 August 2009 at 9:48pm
Thanks for your help on this Uncle Cheese!
It's all working just as I need it to
I'll make a post with my final code so others can share at somepoint this weekend.
|Go to Top|