Server Side Processing and Column Sorting

Server Side Processing and Column Sorting

helpmenothelpmenot Posts: 4Questions: 3Answers: 0
edited May 2017 in Free community support

Hello there. I am using server side processing for my data table. As part of a user requirement I need to sort multiple columns(pressing shift and column click) which i have read is applicable for client side processing can you help me please and provide a link to read if this can also be done in server side processing.

 $(document).ready(function () {
                var dt = $('#tblMaster').DataTable({
                "stateSave": true,     //saving the current view 'April2017
                "processing": true,
                "serverSide": true,
                "info": true,
                "bLengthChange": false,
                "dom": '<"toolbar"> ltp <"bottom"> i',
                buttons: [
                    {
                        text: 'My button',
                        action: function ( e, dt, node, config ) {
                            alert( 'Button activated' );
                        }
                    }
                ],
                 "orderMulti" : true,
                "ajax":{
                    //"url": "@string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"))/Home/AjaxGetJsonData2",
                    "url": "/Home/AjaxGetJsonData2",
                    "type": "post",

This question has an accepted answers - jump to answer

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119
    Answer ✓

    When serverSide: true, DataTables pass a json object that contains the current sort info (column number and direction), its up to the server to use that information to actually implement that code to do the sorting.

    https://datatables.net/manual/server-side details what is passed to the server and what should be passed back

  • losttheplotlosttheplot Posts: 10Questions: 2Answers: 0

    If you are using server side processing but the ordering of your columns is not following your configuration directives, be aware that datatables uses local storage to cache the order directive such that changing the config value will initially have no effect. To see your changes you first need to clear your browser's local storage for the domain being used. It took me quite a while to work out what was going on, or not!

This discussion has been closed.