Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » MultiSelectField Fix

Discuss all other Modules here.

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

Page: 1 2 3 4
Go to End
Author Topic: 5483 Views
  • swaiba
    Avatar
    Forum Moderator
    1788 Posts

    Re: MultiSelectField Fix Link to this post

    Oh god how thick am I, it was the wrong folder name of the module for...

    Requirements::javascript("multiselectfield/javascript/multiselectfield.js");
    Requirements::css('multiselectfield/css/multiselectfield.css');

    ...so sorry to waste your time.

    Barry

  • jam13
    Avatar
    121 Posts

    Re: MultiSelectField Fix Link to this post

    no problem. I needed to look at it anyway.

    I've tagged and released the latest trunk as 0.3, and updated the module page:

    http://silverstripe.org/multiselectfield-module/

    This is tested and working here on 2.3.x and 2.4.x, in SiteTree and ModelAdmin. Please let me know if anyone spots any problems.

  • cmebdisme
    Avatar
    Community Member
    4 Posts

    Re: MultiSelectField Fix Link to this post

    Hiya,

    Is there any chance that the "step by step" instructions could be provided (link doesn't contain any info) for plebs like me.

    Cheers

  • swaiba
    Avatar
    Forum Moderator
    1788 Posts

    Re: MultiSelectField Fix Link to this post

    I think the doc on the module page is quite good, but to try and help...

    take - http://doc.silverstripe.org/datamodel#many_many

    in both dataobject add some static $db (including 'Name')

    in Team add...

    function getCMSFields()
    {
       $fields = parent::getCMSFields();

       $fields->removeFieldFromTab('Root','Categories');
       $dos = DataObject::get('Category');
       $map = $dos ? $map = $dos->toDropdownMap('ID','Name') : array();
       $fields->insertBefore(new MultiSelectField('Categories','Categories, $map),'Name');
    }

    then in ModelAdmin you should see a nice multi select field... not the above is untested... but it should work... let me know and I'll edit it up for a good example.

  • swaiba
    Avatar
    Forum Moderator
    1788 Posts

    Re: MultiSelectField Fix Link to this post

    BTW Jamie did you test this with IE8? chrome, firefox, safari are fine - IE8 not so good for me...

  • jam13
    Avatar
    121 Posts

    Re: MultiSelectField Fix Link to this post

    Don't think I've specifically checked IE8. I'll take a look when I have a minute.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: MultiSelectField Fix Link to this post

    I'm using this with ModelAdmin and ran across the issue that unless a user is a full blown administrator, loading a dataobject produces an error:

    Warning: "implode() [function.implode]: Invalid arguments passed" at line 109 of /home/myclient/public_html/site/multiselectfield/code/MultiSelectField.php

    I went through all the permissions for the security group trying to narrow it down, but nothing matters. I have to assign the group "Full Administrator Rights" for them to be able to load a dataobject within ModelAdmin that uses MultiSelectField in the UI.

  • lx
    Avatar
    Community Member
    82 Posts

    Re: MultiSelectField Fix Link to this post

    Hi Jam13,

    i didnt use your module yet.
    But from the screenshots its clear how it works.

    But i have another problem with many_many or has_many relations.
    What if you have a table with 50.000+ entries.
    Adding some of them, by clicking them in an entire list, wont work, right?

    What would be a good way of doing this in cms?

    I think this must somehow be done by using an autosuggest-searchfield that searches in the 50.000 items table.

    Does anyone know a module or a way to implement this?
    Or maybe an advancement of the MultiSelectField module?

    Thanks

    5483 Views
Page: 1 2 3 4
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.