5121 Posts in 1527 Topics by 1119 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 441 Views |
-
$summary_fields does not display SS_Datetime fields?

12 September 2011 at 9:02pm
Hi, I have a table of dates
class TournamentDate extends DataObject{
static $db = array(
"TournamentDateTime" => "SS_Datetime"
);}
if I view the data in the ModelAdmin, the summary fields consist of the record ID.
If I add
static $summary_fields = array(
"TournamentDateTime" => "Tournament Date"
);the ModelAdmin displays nothing. It just says "No items found", even though looking at the tables, I can see there's two records.
Why?
And how do I get around this?
-
Re: $summary_fields does not display SS_Datetime fields?

13 September 2011 at 12:50am
"casting" could be used to work around this, but I do not know why you have no results at the moment
-
Re: $summary_fields does not display SS_Datetime fields?

13 September 2011 at 1:09am
Thanks for the reply.
Casting sounds a bit involved. Would I have to overload the SS_Datetime class or the ModelAdmin?
I suspect the problem is that the SS_Datetime is a composite field and that's what complicates matters? But really, I've no idea.
-
Re: $summary_fields does not display SS_Datetime fields?

13 September 2011 at 1:20am
casting isn't too invlolved - but yes it's not coming right out of the box
in my view it's a better option that modifying anything in "cms" or "sahppire" -
Re: $summary_fields does not display SS_Datetime fields?

13 September 2011 at 4:33am
You're on the right track - the searchbox on the left stumbles on the composite field. Try the following to replace the composite field by a textfield - you can still search on parts of the datetime...
static $searchable_fields = array(
'TournamentDateTime' => array(
'field' => 'TextField'
)); -
Re: $summary_fields does not display SS_Datetime fields?

13 September 2011 at 4:42am
ah was that it?
believe it or not I've never used the SS_DateTime - everything is with a Date or a Time in my systems.
you also have the option to manipulate the fields from within...
public function scaffoldSearchFields() {
$fields = parent::scaffoldSearchFields();return $fields;
}And if you want to go to town...
http://www.leftandmain.com/silverstripe-tutorials/2011/03/15/taming-the-beast-remodeling-modeladmin-part-2/ -
Re: $summary_fields does not display SS_Datetime fields?

14 September 2011 at 12:40am
@swaiba: neither had I - and now I'm not going to, I think...
Thanks for the link, I had done some heavy remodelling before, but it's not a bad idea to follow a similar track to what others do...
| 441 Views | ||
|
Page:
1
|
Go to Top |


