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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Interactive Filter of ManyManyComplexTableField


Go to End


11 Posts   3200 Views

Avatar
ChurchDude

Community Member, 19 Posts

5 September 2011 at 2:19am

Hello,

I have two dataobjects that are related manymany. In my case I have an event that is related to individuals. I am attempting to record which individuals are attending an event. I have created a ManyManyComplexTableField and when it loads it lists all the individuals in my database and allow me to click the checkbox and save them to the related event.

Is there anyway to allow my users to actively filter the results in the ManyManyComplexTableField individual list?

Thank you in advance for any assistance.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 September 2011 at 3:15pm

Don't you mean ManyManyDataObjectManager? If not, you're in the wrong place!

---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

Avatar
ChurchDude

Community Member, 19 Posts

13 September 2011 at 2:28pm

Very cool. It works rather well.

However, the table render does not look anything like the forum documents on the module. I am rendering it within the datamodel manager. Is there another ss page I should include or is this only made to render within an actual page instead of in the datamodel administrator within the administrator pages?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

14 September 2011 at 5:14am

What do you mean "the forum documents on the module?" What is "datamodel manager?"

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
ChurchDude

Community Member, 19 Posts

14 September 2011 at 1:20pm

Avatar
ChurchDude

Community Member, 19 Posts

15 September 2011 at 12:53pm

My question is what controls the layout of a hasmanydataobject in the model admin when calling it to an addtab field?

Please advise if I need to provide more detail.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 September 2011 at 1:20am

Dude, I'm so lost. Nothing you're saying is making sense to me. Sorry.

Avatar
ChurchDude

Community Member, 19 Posts

16 September 2011 at 4:26am

Edited: 16/09/2011 4:26am

Thanks for your patience as I try to explain this.

Nuts. I was going to attach a screenshot but cant'. I'll paste here. It very closely exactly like what is below. Notice Firstname and Last name are not columns like the example documents for data object manager, they are crammed together in a single column. I am trying to get this to display in a nice columar layout. But it is all squeezed together and does not appear to be using a theme.

_____________________________________________________________
Add An Individual
Displaying 1 to 10 of 49

*
First Name
Last Name
deselect all
*
Jeb
Furious Edit Delete
*
Zeb
Allman Edit Delete
*
Patricia
Allman Edit Delete
*
Mike
Allman Edit Delete
*

Show
results per page

_______________________________________________________________________

Here's the code:
class Family extends DataObject {
...

function getCMSFields() {
$fields=parent::getCMSFields();
$fields->renamefield('Name', _t('Family.SURNAME'));
$fields->renamefield('City',_t('Family.CITY'));
$fields->renamefield('StateProvince',_t('Family.STATEPROVINCE'));
$fields->renamefield('Postalcode',_t('Family.POSTALCODE'));

$tablefield = new HasManyDataObjectManager(
$this,
'Individuals',
'Individual',
array(
'FirstName' => 'FirstName',
'LastName' => 'LastName'
),'getCMSFields_forPopup');

$tablefield->setAddTitle( 'An Individual' );
$fields->addFieldToTab( 'Root.Individuals', $tablefield );
return $fields;
}
...
}

Go to Top