3093 Posts in 875 Topics by 654 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1058 Views |
-
summary fields dont work for me.

21 November 2010 at 6:00am
im currently using a modeladmin to manage a list of events
because the result page only showed the id, i added a $summary_fields to my DataObject
static $summary_fields = array(
"Titel"=>"Titel"
);but when i now press Search i get an error
Warning: "array_fill() [function.array-fill]: Number of elements must be positive" at line 743 of /var/www/example.com/page/cms/code/ModelAdmin.php
i also tried
function summaryFields() {
return array("Titel"=>"Titel");
}but this changed nothing
any solutions for my problem?
-
Re: summary fields dont work for me.

22 November 2010 at 8:46pm
Hi,
could you please provide the full Code of your Class.
The static var is defined correctly. The error has to be somewhere else.Greets,
Robert -
Re: summary fields dont work for me.

23 November 2010 at 6:29am
VAAdmin:
class VAAdmin extends ModelAdmin {
public static $managed_models = array(
'VAKategorie','VAEintrag'
);
static $url_segment = "va";
static $menu_title = "Veranstaltungen";
}VAEintrag:
<?php
class VAEintrag extends DataObject {
static $db = array(
"Titel"=>"Varchar(50)",
"Kontakt"=>"Text",
"Beschreibung" => "Text"
);
static $has_one = array(
"Kategorie" => "VAKategorie"
);
function ShortenDesc($l=200) {
$desc = $this->Beschreibung;
if(strlen($desc) > $l) {
return substr($desc,0,$l)."...";
} else {
return $desc;
}
}
static $searchable_fields = array(
"Titel",
"Kontakt",
"Beschreibung"
);
static $summary_fields = array(
"Titel"=>"Titel"
);
function getCMSFields() {
$categories = DataObject::get('VAKategorie');
if($categories) {
$dropdowndata = $categories->toDropdownMap('ID','Titel','(Eine Kategorie aussuchen)',true);
}
return new FieldSet(
new TextField("Titel"),
new TextareaField("Kontakt"),
new TextareaField("Beschreibung"),
new DropdownField("KategorieID","Kategorie",$dropdowndata)
);
}
}here you are.
-
Re: summary fields dont work for me.

23 November 2010 at 6:43am Last edited: 23 November 2010 7:13am
sorry, didn't see it
It has to be this way:
static $summary_fields = array('Titel');
Rob
-
Re: summary fields dont work for me.

15 December 2010 at 9:47pm
Your code example works for me with both array("Titel") and array("Titel" => "Titel") in 2.4.3
| 1058 Views | ||
|
Page:
1
|
Go to Top |



