Backend\Core\Engine\DataGrid::enableSequenceByDragAndDrop PHP Method

enableSequenceByDragAndDrop() public method

Enable drag and drop for the current datagrid
    public function enableSequenceByDragAndDrop()
    {
        // add drag and drop-class
        $this->setAttributes(array('class' => 'table table-hover table-striped fork-data-grid jsDataGrid sequenceByDragAndDrop'));
        // disable paging
        $this->setPaging(false);
        // hide the sequence column if present
        if ($this->hasColumn('sequence')) {
            $this->setColumnHidden('sequence');
        }
        // add a column for the handle, so users have something to hold while dragging
        $this->addColumn('dragAndDropHandle', null, '<span class="fa fa-reorder"></span>');
        // make sure the column with the handler is the first one
        $this->setColumnsSequence('dragAndDropHandle');
        // add a class on the handler column, so JS knows this is just a handler
        $this->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle fork-data-grid-sortable'));
        // our JS needs to know an id, so we can send the new order
        $this->setRowAttributes(array('data-id' => '[id]'));
    }