Default Sorting and Searching not working

Default Sorting and Searching not working

VeenaworldVeenaworld Posts: 2Questions: 1Answers: 0
edited November 2018 in Free community support
 $(document).ready(function () {
   $.ajaxSetup({
                        cache: false
                    });
                    var gender = null;
var table = $('#studentTable').DataTable({
                        "bProcessing": true,
                        "bServerSide": true,
                        "sAjaxSource": "studentService.asmx/GetStudents",
                        "fnServerData": function (sSource, aoData, fnCallback) {
                            aoData.push({ "name": "gender", "value": gender });
                            $.ajax({
                                "dataType": 'json',
                                "contentType": "application/json; charset=utf-8",
                                "type": "GET",
                                "url": sSource,
                                "data": aoData,
                                "success": function (msg) {
                                    var json = jQuery.parseJSON(msg.d);
                                    fnCallback(json);
                                    $("#studentTable").show();
                                },
                                error: function (xhr, textStatus, error) {
                                    if (typeof console == "object") {
                                        console.log(xhr.status + "," + xhr.responseText + "," + textStatus + "," + error);
                                    }
                                }
                            });
                        }
                        ,
"aoColumnDefs": [
                        { "aaSorting": ["desc", "asc"], "aTargets": [0] }
                        ]
                        ,
                        "aoColumns": [
                        { "aaSorting": ["desc", "asc"] },
                        null,
                        null
                        ]
                        , fnDrawCallback: function () {
                                    $('.image-details').bind("click", showDetails);
                                }
                    });
                });

Answers

  • kthorngrenkthorngren Posts: 20,369Questions: 26Answers: 4,779

    Default Sorting and Searching not working

    Thats not much to go on. Typically when the Datatables features aren't working there is a Javascript error stopping the page. Do you have errors in your browser's console?

    Kevin

  • colincolin Posts: 15,161Questions: 1Answers: 2,588

    Note that you're using serverSide, so it should be your server script that's doing all the ordering/filtering/paging/etc.

    Cheers,

    Colin

  • VeenaworldVeenaworld Posts: 2Questions: 1Answers: 0

    i am not having any errors in Browsers console..that means there is no error in javascript...but what exactly is happening and why it is not working dont know..

  • colincolin Posts: 15,161Questions: 1Answers: 2,588

    As I said, the server will be doing the work - so check and see what data the server is returning.

This discussion has been closed.