Login | Forgot password | Register
What is OpenID?
OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.
With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.
For more information visit the official OpenID site.
General Questions
SilverStripe Forums » General Questions » ModelAdmin search customization
General questions about getting started with SilverStripe that don't fit in any of the categories above.
|
Page:
1
|
Go to End | |
| Author | Topic: ModelAdmin search customization | 201 Views |
-
ModelAdmin search customization

26 June 2009 at 11:08am
If I have a managed model that I want to restrict which of the DataObjects in the model can be searched for. For example I have a DataObject Student that has_one school so that some of the students have school A and some have school B. I want the ModelAdmin that is managing Students to only be able to search for students that are in School A and not School B. I would think that I could have a hidden field in the SearchForm that has the School A statically defined. I don't know how to accomplish. I want the search to work as if the person searching has put School A in the School search form but I don't actually want the person to see the form or be able to put anything in it.
I hope this makes sense.
-
Re: ModelAdmin search customization

10 July 2009 at 12:05pm Last edited: 10 July 2009 12:05pm
On the student dataobject there are a lot of parameters that might help to include. I'm not sure if it'll solve the issue but try adding
static $searchable_fields = array(
'school '
);static $defaults = array(
"school " => 'A'
);And then I think you'll need to over write the modeladmin search form with $this->fields->removeByName('school ');
I'm not that familiar with SilverStripe, let alone ModelAdmin, so this is guessing form what I've read so far
| 201 Views | ||
|
Page:
1
|
Go to Top |
Currently Online: ikhwanb, holy noli, steeeo, Thomas B. Nielsen
Welcome to our latest member: holy noli


