In my config I have set the default Formatter setting, but I have an single column in my Index GridView that I would like to override the thousandSeparator to be ’ ’ instead of the default ‘,’, how can I achieve this?
This is my current view definition for the column in question
[
'attribute'=>'Finish',
'contentOptions' => ['class' => 'text-right'],
'format'=>['decimal', 0],
],
Hi there,
The syntax for format is right as per your code above.
You can refer the page
https://www.yiiframework.com/doc/api/2.0/yii-i18n-formatter#$decimalSeparator-detail
and some times based on your time zone you set the decimal separator may take effect!
DBCreator
(DBCreator)
June 10, 2019, 1:00am
3
Any chance you could give me a formal example on how I would implement it with my column code?
DBCreator:
[ ‘attribute’=>‘Finish’, ‘contentOptions’ => [‘class’ => ‘text-right’], ‘format’=>[‘decimal’, 0], ],
Try with this code
[
'attribute'=>'Finish',
'contentOptions' => ['class' => 'text-right'],
'format'=> 'decimal',
],
DBCreator
(DBCreator)
June 27, 2019, 6:14pm
5
Gives me the same result, since it will rely on the default formatter properties from my config file.
I was hoping I could do something like
[
'attribute'=>'Finish',
'contentOptions' => ['class' => 'text-right'],
'formatter' => [
'thousandSeparator' => ' ',
],
'format'=>['decimal', 0],
],
or
[
'attribute'=>'Finish',
'contentOptions' => ['class' => 'text-right'],
'format'=>['decimal', 0, [ 'thousandSeparator' => ' ']],
],
but of course neither of these works.
I figure it can be overridden using options, just can’t figure it out or find any online examples either.