Fixes on reordering categories
This commit is contained in:
@@ -10,6 +10,10 @@ use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class ParentDataTable extends DataTable
|
||||
{
|
||||
public $rowReorder;
|
||||
public $colReorder; // ['selector' => 'tr']
|
||||
public $fixedColumns; // ['leftColumns' => 1, 'rightColumns' => 1]
|
||||
|
||||
/**
|
||||
* Build DataTable class.
|
||||
*
|
||||
@@ -18,7 +22,12 @@ class ParentDataTable extends DataTable
|
||||
*/
|
||||
public function dataTable($query)
|
||||
{
|
||||
return $this->addButtons(datatables()->eloquent($query));
|
||||
return $this->modifier(datatables()->eloquent($query));
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
return $this->addButtons($datatables);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,11 +55,11 @@ class ParentDataTable extends DataTable
|
||||
public function makeColumnButtons()
|
||||
{
|
||||
return Column::computed('action')
|
||||
->title('')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->searchable(false)
|
||||
->width(120)
|
||||
->addClass('text-center');
|
||||
->addClass('text-center text-nowrap');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,19 +95,30 @@ class ParentDataTable extends DataTable
|
||||
->setTableId($id)
|
||||
->parameters($this->getParameters())
|
||||
->columns($this->getColumns())
|
||||
->minifiedAjax()
|
||||
->ajax(['data' => "function(d) { d.filters = $('#filters').serializeJSON(); }"])
|
||||
->dom($this->getDom())
|
||||
->orderBy(0,'asc')
|
||||
->buttons(
|
||||
Button::make('export'),
|
||||
Button::make('print')
|
||||
);
|
||||
->buttons($this->getButtons());
|
||||
}
|
||||
|
||||
public function getButtons() {
|
||||
return [
|
||||
Button::make('export'),
|
||||
Button::make('print'),
|
||||
Button::make('colvis'),
|
||||
Button::make('columnsToggle')
|
||||
];
|
||||
}
|
||||
|
||||
public function getParameters()
|
||||
{
|
||||
return [
|
||||
'pageLength' => 10
|
||||
'pageLength' => 5,
|
||||
'scrollX' => true,
|
||||
'scrollCollapse' => true,
|
||||
'colReorder' => $this->colReorder,
|
||||
'rowReorder' => $this->rowReorder,
|
||||
'fixedColumns' => $this->fixedColumns,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -106,7 +126,7 @@ class ParentDataTable extends DataTable
|
||||
{
|
||||
$dom = '';
|
||||
// $dom .= $this->getDatatablesHeaderDefault();
|
||||
$dom .= "tr";
|
||||
$dom .= "<'overlay-block'r<t>>";
|
||||
$dom .= $this->getDatatablesFooterDefault();
|
||||
return $dom;
|
||||
}
|
||||
@@ -136,7 +156,7 @@ class ParentDataTable extends DataTable
|
||||
}
|
||||
|
||||
public function getDatatablesFooterDefault() {
|
||||
return "<'row dt-toolbar-footer'<'col-md-6'i><'col-md-6'p>>";
|
||||
return "<'row pt-3 dt-toolbar-footer'<'col-md-6'i><'col-md-6'p>>";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,8 +174,8 @@ class ParentDataTable extends DataTable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildFilename($models_name)
|
||||
protected function buildFilename($name)
|
||||
{
|
||||
return $models_name . '_' . date('YmdHis');
|
||||
return $name . '_' . date('YmdHis');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user