简体   繁体   中英

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. 表格打印屏幕

Your help will be highly appreciated.

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>";
}

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM