I ran into interesting problem, which I can't solve in a easy way, so thought someone could help me on that. (Well, I think the solution could be in interest for other members)
The situation is -
1. I've got a list of services which are extended from "Page" class and are used as a pages of services description on the website.
These have Many_many relation to Case studies:
static $belongs_many_many = array( 'CaseStudy' => 'CaseStudy' );
2. I've got a Case studies list , which would include several Services out of all of services
static $many_many = array( 'Services' => 'Services' ); . . . $tablefield = new ManyManyComplexTableField( $this, 'Services', 'Services', array( 'Title' => 'Title' ), 'getCMSFields_forPopup' ); $tablefield->setPermissions(array('print')); $f->addFieldToTab("Root.Content.Services", $tablefield);
Admin adds services as pages, and then can tick the checkbox for each CaseStudy , to indicate which services where used for the particular case study.
Now the problem to be solved:
On the case study page I need outputting ALL of the services , however those that are checked for that case study should have different highlighting color. I thought of approach where I' would select all services in one query, selected service in other query , run a one-by-one comparison, adding extra value, for those that should be highlighted. However , it looks to me that this could be somehow in a more "proper" datamodel approach, so if you have any ideas how to implement that in a proper way - would appreciate your help.