21294 Posts in 5734 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 880 Views |
-
Boolean->Nice in ModelAdmin

15 September 2010 at 12:32am
Hi,
In the ss book (when created a TableListField for displaying data) there is a line to cast Boolean data into 'Boolean->Nice' so that instead of Value (field name) and 0 or 1 (data) instead appears Value? and Yes or No.
Is there away to apply this to ModelAdmin please?
Barry
-
Re: Boolean->Nice in ModelAdmin

22 September 2010 at 9:27pm
found the answer...
static $casting = array(
"MyTextBoolean" => "Text"
);public static $summary_fields = array (
...
'MyTextBoolean'=>'IsTrue?',
);public function MyTextBoolean()
{
$str = 'No';
if ($this->BooleanField== true)
$str = 'Yes';return $str;
}
| 880 Views | ||
|
Page:
1
|
Go to Top |

