yajra Datatables with styled results

Posted 6 months ago by ochirach


Version: Datatables 7.0 | Laravel 5.4

After browsing the issues I have managed to convert my datatable logic from Collection based to Query based due to the significant performance improvement (i'm now getting < 1 second with query based from the 3-5 seconds with collection based).

My ISSUE now is that the custom formatting of query results I implemented prior cannot be maintained as the query does not user '->get()' to access the results.

Example scenario of the issue: I used to check if the user was an admin, editor, guest, etc then format the style of the user.role query result with different coloured labels to represent the role. Afterwards I add this to the collection then return to view for better readability of the table results.

Is this formatting possible with query based datatables (now that the ->get() has been removed)?


Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.