4

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.

doylefelix
  • 117
  • 3
  • 12
  • A quick Google makes it look like Grocery CRUD has templates. So, just edit your template. Alternatively, right click on that column in your browser and select "inspect element", which will open the developer tools and let you examine the corresponding CSS. Update the CSS to `text-align:right` – Mawg says reinstate Monica May 05 '14 at 02:51

2 Answers2

5

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>";
}
Alex W
  • 37,233
  • 13
  • 109
  • 109
0

You can assign a common class to the "td" for which you want the text alignment as right.

.abc{
  text-align:right;
}

Please check the below jsfiddle for refrence:

http://jsfiddle.net/Rushikesh/mpsfD/

Rushikesh
  • 176
  • 5