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.

General Questions /

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

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

Searchable_Fields pulldown Model Admin


Go to End


2 Posts   721 Views

Avatar
woodb2

Community Member, 48 Posts

18 November 2011 at 5:08am

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

Avatar
swaiba

Forum Moderator, 1899 Posts

21 November 2011 at 11:19pm

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