Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Searchable_Fields pulldown Model Admin

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 355 Views
  • woodb2
    Avatar
    Community Member
    48 Posts

    Searchable_Fields pulldown Model Admin Link to this post

    I currently have a DataObject "enhancements"

    For searchable fields I have:

    static $searchable_fields = array(
       'Requester' => 'Requester',
    'Title' => 'Title',

    I want to create a pulldown for a Status field that has options of Active, Pending, Completed inside my search area ModelAdmin. I can get to work as a text field, but not a pulldown

    I've searched the forums and all I can find is that ModelAdmin will create pulldowns automatically in the search area for fields from related objects like:

    static $searchable_fields = array(
    'ArticleTypeID' =>array( 'title' => 'Article Type' )
    );

    I've also stumbled onto this example:

    static $searchable_fields = array(
    "Organisation.ZipCode" => array(
    "field" => "TextField",
    "filter" => "PartialMatchFilter",
    "title" => 'Organisation ZIP'
    )
    );

    If I modifiy it to fit my example... changing Organisation.ZipCode to Status and TextField to Pulldown, I do get a pulldown, but it's blank.

    Any help would be appreciated.

    Brian

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: Searchable_Fields pulldown Model Admin Link to this post

    as a last resort you can always manipulate the fields as you want with...

       public function scaffoldSearchFields() {
          $fields = parent::scaffoldSearchFields();
          
          //do stuff with $fields

          return $fields;
       }

    355 Views
Page: 1
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.