我正在使用数据表。我在pdf中导出table
。如何为pdf中导出的table
应用自定义样式?
这是我的代码:
table = $(tableId).DataTable({
dom: 'frtip',
ajax: 'https://api.myjson.com/bins/qgcu',
ordering: false,
searching:false,
buttons: [
{
extend: 'collection',
text: 'Export',
buttons: [ {
extend: 'pdf',
filename : fileName,
title : rprtTtl,
orientation: "portrait",
pageSize : "LETTER",
defaultStyle: {
margin: 'auto',
},
customize: function (win) {
console.log(win);
$(table)
.css('margin', 'auto')
}
},
{
extend: 'excel',
filename : fileName,
title : rprtTtl,
orientation: "landscape",
pageSize : "A3"
}]
}
]
});
实际上在pdf中我的table
是aligned left
。我想align
table
center
css
。如何为此应用自定义public $paginate =[
'limit' => 10,
'order' => [
'tble.id' => 'asc'
]
];
public function initialize()
{
parent::initialize();
$this->loadComponent('Paginator');
}
public function index()
{
$product = TableRegistry::get('tble');
$query = $product->find();
$this->set(array('data'=>$query));
$this->set('tble', $this->paginate($query));
$this->render('index');
}
?