laravel-datatables-html icon indicating copy to clipboard operation
laravel-datatables-html copied to clipboard

Add position for Index Col

Open chrisangle opened this issue 5 years ago • 2 comments

Summary of problem or feature request

Code snippet of problem

// src/Html/Columns/Index.php
public function addIndex(array $attributes = [], $position = false)
    {
        $indexColumn = $this->config->get('datatables.index_column', 'DT_RowIndex');

        $attributes = array_merge([
            'defaultContent' => '',
            'data' => $indexColumn,
            'name' => $indexColumn,
            'title' => '',
            'render' => null,
            'orderable' => false,
            'searchable' => false,
            'exportable' => false,
            'printable' => true,
            'footer' => '',
        ], $attributes);
   
        if ($position === true) {
            $this->collection->prepend($column);
        } elseif ($position === false || $position >= $this->collection->count()) {
            $this->collection->push($column);
        } else {
            $this->collection->splice($position, 0, [$column]);
        }

        return $this;
    }

System details

  • Operating System: Linux
  • PHP Version: 7.2.22
  • Laravel Version: 7.x
  • Laravel-DataTables Version: 9.11

chrisangle avatar Sep 28 '20 04:09 chrisangle

@chrisangle thank you for the suggestion, would you be able to submit a PR for this proposal?

yajra avatar Oct 06 '20 05:10 yajra

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 09 '22 03:10 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Oct 16 '22 04:10 github-actions[bot]