5121 Posts in 1527 Topics by 1119 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1325 Views |
-
[Solved] Adding Custom Fields to Summary_fields

12 April 2011 at 10:47pm
Hi ya,
Ok got a weird one here, I'm trying to add some fields to the summary_fields list so that i can see them in Model Admin and i'm getting an 'Uncaught Exception: Unable to traverse to related object field [NiceTime] on [Course]' error.
Now the weird bit, if i upload the code and don't refresh the browser it all works fine, the moment i refresh i get the error now i'm sure my code is correct, please tell me if I'm wrong.
static $db = array(
'DateTaken' => 'Date'
);
static $summary_fields = array(
'Skill.Title' => 'Skill',
'NiceTime' => 'Date Passed',
);
public function getNiceTime() {
return $this->obj('DateTaken')->Nice();
}
This is just a simple function there is another function i want to use which calculates the expiry date of a course which also doesn't work, same error so is this a bug or am i being an idiot?Hope someone can help, oh this is on 2.4.5.
Mick
-
Re: [Solved] Adding Custom Fields to Summary_fields

14 April 2011 at 8:54pm
**BUMP***
Anyone, is my code right, or has anyone had similar problems passing functions to the summary_fields?
Mick
-
Re: [Solved] Adding Custom Fields to Summary_fields

14 April 2011 at 9:13pm
By default the summary fields definition is also used for the searchable fields. Since searchable fields can only operator on fields that actually exist in the DB, it's erroring out. You'll need to define a separate searchable_fields on your object without the NiceTime field.
-
Re: [Solved] Adding Custom Fields to Summary_fields

14 April 2011 at 10:13pm
That was it...
many thanks for that, much appreciated.
Mick
| 1325 Views | ||
|
Page:
1
|
Go to Top |


