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.

Archive

Our old forums are still available as a read-only archive.

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

ModelAdmin


Reply

17 Posts   3942 Views

Avatar
Fuzz10

25 November 2008 at 9:29pm Community Member, 787 Posts

Hmm, odd.

Works for me ...

Although I have only used a very simple data-object class ....

Avatar
UncleCheese

26 November 2008 at 3:46am 4085 Posts

Would you mind posting all of your relevant code?

Avatar
Fuzz10

26 November 2008 at 5:18am Community Member, 787 Posts

Sure, no problem... ;-)

Data-class :

class Bestelling extends DataObject {

static $db = array(
   'BestelNummerID' => 'Int',
   'BestellingText' => 'HTMLText'
);

static $searchable_fields = array(
'BestellingText' => 'PartialMatchFilter'
);

And the modeladmin class

class AdminBestelling extends ModelAdmin
{
protected static $managed_models = array (
'Bestelling'
);

static $url_segment = 'beheer';
static $menu_title = 'Bestellingen';
}

Avatar
UncleCheese

27 November 2008 at 4:19am 4085 Posts

I suddenly feel really stupid. This isn't bundled with the 2.2.3 release, is it? I can't find a ModelAdmin class anywhere in my filesystem. Is it something I can only get from the trunk?

Avatar
Fuzz10

27 November 2008 at 4:34am Community Member, 787 Posts

;-)

Hhaa.. indeed , you need to download the latest trunk release (2.3)...

Avatar
Ingo

29 November 2008 at 9:42pm Forum Moderator, 801 Posts

Good to see some interest in ModelAdmin, we found it to be a quite handy tool for quick data entry, prototyping as well as fully fledged admin interfaces. You're right, there's very little documentation on it, I'll try to extend http://doc.silverstripe.com/doku.php?id=modeladmin before the final 2.3 release (see http://open.silverstripe.com/ticket/3172)

Avatar
Apophenian

8 December 2008 at 3:32pm Community Member, 46 Posts

Sorry to hijack this thread, but does the $searchable_fields array impact the front end search in any way, or is it just restricted to the admin area?

Avatar
Ingo

8 December 2008 at 3:49pm Forum Moderator, 801 Posts

The SearchForm class currently doesn't use DataObject::$searchable_fields, thats still on the list - but there's nothing keeping you from implementing your own SearchContext in the frontend generally.