Skip to content

Commit

Permalink
Fix adding of index column.
Browse files Browse the repository at this point in the history
Introduced on #1852.
  • Loading branch information
yajra committed Nov 23, 2018
1 parent 040eef2 commit 3a34cf7
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/Processors/DataProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ class DataProcessor
*/
protected $includeIndex;

/**
* @var string
*/
protected $indexColumn;

/**
* @var array
*/
Expand Down Expand Up @@ -100,8 +95,6 @@ public function __construct($results, array $columnDef, array $templates, $start
public function process($object = false)
{
$this->output = [];
$indexColumn = config('datatables.index_column', 'DT_RowIndex');

foreach ($this->results as $row) {
$data = $this->escapeRow(Helper::convertToArray($row));
$value = $this->addColumns($data, $row);
Expand Down Expand Up @@ -141,8 +134,10 @@ protected function addColumns($data, $row)
*/
protected function addIndexColumn($data)
{
$indexColumn = config('datatables.index_column', 'DT_RowIndex');

if ($this->includeIndex) {
$data[$this->indexColumn] = ++$this->start;
$data[$indexColumn] = ++$this->start;
}

return $data;
Expand Down

0 comments on commit 3a34cf7

Please sign in to comment.