Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Interactive Filter of ManyManyComplexTableField

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1016 Views
  • ChurchDude
    Avatar
    Community Member
    19 Posts

    Interactive Filter of ManyManyComplexTableField Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Interactive Filter of ManyManyComplexTableField Link to this post

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

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

  • ChurchDude
    Avatar
    Community Member
    19 Posts

    Re: Interactive Filter of ManyManyComplexTableField Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Interactive Filter of ManyManyComplexTableField Link to this post

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

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

  • ChurchDude
    Avatar
    Community Member
    19 Posts
  • ChurchDude
    Avatar
    Community Member
    19 Posts

    Re: Interactive Filter of ManyManyComplexTableField Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Interactive Filter of ManyManyComplexTableField Link to this post

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

  • ChurchDude
    Avatar
    Community Member
    19 Posts

    Re: Interactive Filter of ManyManyComplexTableField Link to this post

    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;
    }
    ...
    }

    1016 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.