Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81767

Empty Data Source causes "requested unknown parameter"

$
0
0
I have a datatable setup like such:

   var oTable = $('#documentList').dataTable({
        "bPaginate": true,
        "iDisplayLength": 50,
        "bFilter": true,
        "aaSorting": [[ 3, "asc" ]],
        "sDom": 'tr<"F"ip>',
        "sPaginationType": "bootstrap",
        "bProcessing" : true,
        "bServerSide": true,
        "sAjaxSource": "/Document/GetDocuments/",
        "sServerMethod": "POST",
        "sDefaultContent": "",
        "fnServerParams": function (aoData) {
            aoData.push(
                { "name": "isRefresh", "value": true },
                { "name": "projectId", "value": "69606992-3aea-4b4e-9e0b-a0bcb19f68eb" }
            );
        },
        "aoColumns":
        [
            {
                "mData": "DocumentId",
                "bVisible": false,
                "sName": "DocumentId"
            },
            {
                "mData": null,
                "sDefaultContent" : "",
                "mRender" : function (data, type, full) {
                    return '<input type="checkbox" />';
                }
            },
            {
                "mData": null,
                "bSortable": false,
                "sDefaultContent": "",
                "mRender": function (data, type, full) {
                    return '<i class="icon-edit"></i>'
                            +   '<i class="icon-remove"></i>'
                            +   '<i class="icon-eye-open"></i>';
                }
            },
            {
                "mData": "DocumentNumber",
                "sName": "DocumentNumber",
                "sTitle": "Document Number"
            },
            {
                "mData": "Title",
                "sName": "Title",
                "sTitle": "Title"
            },
            {
                "mData": "DateUpdated",
                "sName": "DateUpdated",
                "sTitle": "Date Updated"
            }
        ],
        "fnDrawCallback": function (oSettings) {
            $('.icon-edit').tooltip({
                "title": "Edit the document"
            });

            $('.icon-remove').tooltip({
                "title": "Move document to trash"
            });

            $('.icon-eye-open').tooltip({
                "title": "View the document details"
            });
        }
    });


If I remove these two empty data source columns:

            {
                "mData": null,
                "sDefaultContent" : "",
                "mRender" : function (data, type, full) {
                    return '<input type="checkbox" />';
                }
            },
            {
                "mData": null,
                "bSortable": false,
                "sDefaultContent": "",
                "mRender": function (data, type, full) {
                    return '<i class="icon-edit"></i>'
                            +   '<i class="icon-remove"></i>'
                            +   '<i class="icon-eye-open"></i>';
                }
            },

Everything is great, but leave them in and I get the classic "DataTables warning (table id = 'documentList'): Requested unknown parameter from the data source for row 0.

Any idea what I'm doing incorrect?

Viewing all articles
Browse latest Browse all 81767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>