How to use sorting on server side ?

How to use sorting on server side ?

reikireiki Posts: 46Questions: 11Answers: 0

i got my server side to true, where do i setup the code to sort and order the column in laravel using yajrabox ? i have no idea cause the example in serverside in this website not showing where do i put the serverside code to begin with , if its in the same route with the ajax ? if so is there any example of how to get the data and return it back to the datatables ? is it the same as initial table ?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    where do i setup the code to sort and order the column in laravel using yajrabox ?

    Probably best to ask in the Yajra support channels. That isn't software produced or supported by us I'm afraid.

    i have no idea cause the example in serverside in this website not showing where do i put the serverside code to begin with

    In this example it is in the PHP script server_processing.php. Laravel has a different way of routing from plain PHP files though, so I'm not sure that example will be all that useful to you.

    Allan

  • reikireiki Posts: 46Questions: 11Answers: 0

    Okay thanks @allan , its hard cause the yajra doc has only little explanation

  • reikireiki Posts: 46Questions: 11Answers: 0

    okay i found out how, for the people in the future who had same problem basically the datatables still goes to the AJAX url you provide and it give another payload which is order[0][column] and order[0][dir] then you can do this on your controller that your ajax url point to :

    $orderColumn = isset($request->order[0]['column']) ? $request->order[0]['column'] : null;
    $orderDir = isset($request->order[0]['dir']) ? $request->order[0]['dir'] : null;
    

    you need isset because at inisialization both of those payload is not exist yet until you sort thru table header

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Super - thanks for posting back.

    Allan

Sign In or Register to comment.