Skip to content

Why is this code working? Didn't see it in docs #2749

Answered by yajra
cooperinho asked this question in Q&A
Discussion options

You must be logged in to vote

Why is the ->ajax() method used? without it it doesn't work. At first I tried to follow the docs but nothing worked, until I compared my code to an existing datatable code in the project and realized that it's working when adding the ajax method

You should use the dataTables render function to be able to handle multiple actions/request:

$dataTable->render('view.path')
  1. It will render the view on regular http GET request
  2. It will render json data if requested via ajax
  3. It will handle the export (xls, csv, pdf), print and custom table actions

Why I can set the columns title using this array syntax (['title' => 'ID', 'data' => 'id']) - I didn't find it in the docs, but it works!

You can u…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cooperinho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants