5095 Posts in 1518 Topics by 1114 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1681 Views |
-
ModelAdmin with list

10 June 2009 at 1:53am
Hi Everyone
I'm pretty new on ModelAdmin, but it's up and running and really great. However, instead of having this boring message: " Welcome to SilverStripe CMS. Please choose one of the entries in the left pane", I would like to show a list in the right pane based on the data in my ModelAdmin.
These are my files:
<?php
class RegionsAdmin extends ModelAdmin {
protected static $managed_models = array(
'Region'
);
static $url_segment = 'regioner'; // will be linked as /admin/mycrm
static $menu_title = 'Regions';
}
?><?php
class Region extends DataObject {
static $db = array(
'Navn' => 'Text',
'Hovedstad' => 'Text',
'Areal' => 'Text',
'Indbyggere' => 'Text',
'Vine' => 'Text'
);
static $searchable_fields = array(
'Navn',
'Hovedstad',
'Areal',
'Indbyggere',
'Vine'
);
static $summary_fields = array(
'Navn',
'Hovedstad',
'Vine'
);
function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
}
?>But how do I create a list based on my Regions class?
Joel
-
Re: ModelAdmin with list

14 June 2009 at 10:23pm
You can overload the right template by adding a new Layout template called RegionAdmin_right.ss (see ModelAdmin_right.ss for clues on the necessary markup). You can then extend your RegionAdmin class the same way you would with any other template+controller combination to fetch a DataObjectSet and display it through a <% control %> in the template. Specifically for performing a search by default in ModelAdmin, please follow this ticket: http://open.silverstripe.com/ticket/3693
-
Re: ModelAdmin with list

22 March 2010 at 12:31am
Hi Ingo
Did this feature about performing a search by default ever get implemented? If so, how do I get a search click by deafult?
Joel
-
Re: ModelAdmin with list

13 April 2010 at 8:40pm
The ticket I've referenced in the post you've answered is still open, right? ;)
-
Re: ModelAdmin with list

13 April 2010 at 8:54pm
Well, I tried, but nothing really happend. Should the
just work?$default_search = true
-
Re: ModelAdmin with list

9 December 2010 at 4:12pm
Anyone know how to get the "search by default" thing to work?
-
Re: ModelAdmin with list

9 December 2010 at 8:29pm
You can do it with JavaScript. For instance for a ModelAdmin for a 'Product' DataObject:
Javascript: http://pastie.org/1361257
PHP: http://pastie.org/1361261
| 1681 Views | ||
|
Page:
1
|
Go to Top |




