Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make specific Grocery CRUD table columns right-align?

Is there a way to make a specific column right-aligned that was rendered by Grocery CRUD?

In my case, I want to specifically right-align the column Bonus Value only. Print Screen of the Table

Your help will be highly appreciated.

like image 353
doylefelix Avatar asked Sep 12 '25 19:09

doylefelix


1 Answers

In your controller, make the column you want right-aligned a callback column. Then, put some HTML with inline CSS that will right-align your text.

Controller CRUD code:

$this->grocery_crud->callback_column('bonus_value',array($this,'_column_bonus_right_align'));

Callback function in controller:

function _column_bonus_right_align($value,$row)
{
    return "<span style=\"width:100%;text-align:right;display:block;\">".$value."</span>";
}
like image 167
Alex W Avatar answered Sep 15 '25 08:09

Alex W