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'
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!
Most helpful comment
It's added column and not part of the DB that's why it's not sortable. To fix, do: