Datatable not showing anything

Datatable not showing anything

camaross1220camaross1220 Posts: 2Questions: 1Answers: 0

I'm using version 1.10.15 server side, the ajax return draw, recordsTotal, recordsFiltered and data (array), it receives here on success console log, but nothing on table, it don't even have regular footer that usually shows Showing 10 of 100 etc...

datatable = $('#Tbl_Details').DataTable({
                    "paging": true,
                    //"proccessing": true,
                    "serverSide": true,
                    "lengthChange": true,
                    "lengthMenu": [10, 50, 100, 150, 200],
                    //"searching": true,
                    "ordering": false,
                    "info": true,
                    "autoWidth": false,
                    "language": {
                        "emptyTable": "No records found." //customize empty table message
                    },
                    "ajax": {
                        type: "POST",
                        url: "@(Url.Action("LoadFeedbackAlertListing", "E004_FeedbackAlertListing"))",
                        data: function(d) {
                            d.FromDate = $.trim(FrmDate.value);
                            d.ToDate = $.trim(ToDate.value);
                            d.DepartmentCodeList = $.trim(sLocCode);
                            d.CustomerDecision = '';
                            d.FeedbackAlertNo = '';
                            d.start = d.start || 0;
                            d.length = d.length || 10;
                            d.draw = d.draw || 1;
                            return d;
                        },
                        "success": function (response) {
                            console.log(response.data);
                        },
                        "error": function (xhr, error, thrown) {
                            console.log(xhr);
                            alert('DataTables warning: ' + error);
                        },
                        dataSrc: "data"
                    },
                    "columns": [
                        { data: 'Department' },
                        { data: 'FeedBackAlertId' },
                        { data: 'FeedbackAlertNo' },
                        { data: 'FollowUpAction' },
                        { data: 'ShouldRequireCustomerApproval' }
                ]   
            });

and my table code

            <table id="Tbl_Details" class="table table-striped table-bordered">
                    <thead>
                        <tr class="info">
                            <th style="text-align: center">Feedback Alert No.</th>
                            <th style="text-align: center">Department</th>
                            <th style="text-align: center">Follow Up Action</th>
                            <th style="text-align: center">Report</th>
                            <th style="text-align: center">Action</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>

Any help would be appreciated, thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    As the ajax documentation says:

    success - Must not be overridden as it is used internally in DataTables.

    So remove that to start with.

    Next, do you need server-side processing (i.e. tens of thousands of rows, or more)? If not, remove the serverSide option and just use client-side processing.

    If you do need it, then please can you show me the full JSON returned from the server.

    Allan

  • camaross1220camaross1220 Posts: 2Questions: 1Answers: 0

    Thanks, I removed success and it shows now

Sign In or Register to comment.