2

There is number column which represents price. How to align it to the right in the table grid. I tired

$this->crud->addColumn([
            'name' => 'amount',
            'type' => 'number',
            'label' => 'Amount',
            'align' => 'right',
        ]);
Rudolph
  • 139
  • 1
  • 8

3 Answers3

4

There wasn't a way in 2018, but in 2021 I can align a column to the right by using a wrapper like this:

$this->crud->addColumn([
    'name' => 'amount',
    'type' => 'number',
    'label' => 'Amount',
    'wrapper' => [
        'element' => 'span',
        'style' => 'float:right',
    ],
]);
PaulH
  • 2,918
  • 2
  • 15
  • 31
1

Hmm... I don't think there's a way to do that with existing columns. But a fast way to achieve it would be to create your own column type, say... number_aligned_right, based on the code for the numbers column.

tabacitu
  • 6,047
  • 1
  • 23
  • 37
1

found a better solution with the bootstrap class. main idea from => @paulh

'wrapper' => [
                'element' => 'div',
                'class' => 'text-right',
            ],
Shakib
  • 41
  • 2
  • 7