Laravel-datatables: Unknown column 'DT_Row_Index' in 'order clause'

Created on 20 Sep 2018  路  5Comments  路  Source: yajra/laravel-datatables

Summary of problem or feature request

i add
->addIndexColumn()

in Controller,

in view I add

{ data: 'DT_Row_Index', name: 'DT_Row_Index' }

This error always appear :
Unknown column 'DT_Row_Index' in 'order clause'

question

Most helpful comment

It's added column and not part of the DB that's why it's not sortable. To fix, do:

{ data: 'DT_Row_Index', name: 'DT_Row_Index' , orderable: false, searchable: false}

All 5 comments

It's added column and not part of the DB that's why it's not sortable. To fix, do:

{ data: 'DT_Row_Index', name: 'DT_Row_Index' , orderable: false, searchable: false}

@yajra Thanks a lot yajra, is that impossible to sort that coloumn ?

Yes, I think it's impossible because index column is not part of the database / query. My usual guide is if it's doable on SQL level, the package should be able to handle it. Otherwise, it's not possible.

@yajra : ok I get it, btw thanks again for this great package,

how about adding notes for this one :
{ data: 'DT_Row_Index', name: 'DT_Row_Index' , orderable: false, searchable: false}

in : https://yajrabox.com/docs/laravel-datatables/master/index-column

Oh thanks, will add that when I got the chance. You can also PR if you can at https://github.com/yajra/laravel-datatables-docs/blob/master/index-column.md. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ruchisheth picture ruchisheth  路  16Comments

baig772 picture baig772  路  14Comments

AbuHamdah picture AbuHamdah  路  33Comments

mantrax314 picture mantrax314  路  15Comments

webwizard02 picture webwizard02  路  17Comments