On dashboard, if I want formatted fields, for example, date and money, I'll do like:
...
protected function fields()
{
return [
DateTime::create('dt')->displayFormat('m/y'),
Currency::create('val')
->label('Value')
->BRL()
->symbol()
->decimals(2)
];
}
On pure KR style inside dashboard, how do I do the same formatting?
I have tried this, but can't get it to work:
...
->dataSource(...->run())
->columns([
'dt' => ['type' => 'string'],
'val' => ['type' => 'number', 'formatValue'=>function($value, $row){
return Currency::create($value)
->label('Value')
->BRL()
->symbol()
->decimals(2);
}]
])
Is it possible to pass DataTime and Currency classes to formatValue or column to get the same formatting as in fields function?
The reason I'm at it now is because I was tring hard to not mix pure KR into dashboard but I guess I'm givin it up.