Getting "requested unknown parameter '0' from the data source for row 0 datatable", can't figure out

Getting "requested unknown parameter '0' from the data source for row 0 datatable", can't figure out

Parker3306Parker3306 Posts: 3Questions: 1Answers: 0

I'm trying to figure out why my data isn't showing up in the DataTable with server side ajax call. My DataTables debugger code is exogeg. Here is my html/js in DataTables live: http://live.datatables.net/gasapela/1/

I've looked over a bunch of forum posts with the same error, but the things listed haven't seemed to fix this particular one. If I need to add something more, please let me know. Thanks for taking a look.

This question has an accepted answers - jump to answer

Answers

  • Parker3306Parker3306 Posts: 3Questions: 1Answers: 0

    Is posting the code in the comment preferred?

  • allanallan Posts: 63,704Questions: 1Answers: 10,502 Site admin
    Answer ✓

    Hi,

    Thanks for picking up the priority support option! And also for the debug trace and code.

    The issue here is the use of sName in the columns - you actually want to use the columns.data property or mData if you want to use the legacy form.

    So my suggestion would be to use:

    {
        "bServerSide": true,
        "bProcessing": true,
        "sAjaxSource": "Home/AdvancedSearch?vDrawNum=&vProject=&vCustomer=&vDesc=&vCreatedBy=Don Marx&vDateCreated=",
        "aoColumns": [{
            "mData": "PartNumber"
        }, {
            "mData": "RFQ"
        }, {
            "mData": "CreatedBy"
        }, {
            "mData": "DateCreated"
        }]
    }
    

    Or in 1.10 style (you might also need to add $.fn.dataTable.ext.legacy.ajax = true; if your search code on the server-side is expecting the legacy parameters - just add that line immediately before you create the DataTable):

    {
        "serverSide": true,
        "processing": true,
        "ajax": "Home/AdvancedSearch?vDrawNum=&vProject=&vCustomer=&vDesc=&vCreatedBy=Don Marx&vDateCreated=",
        "columns": [{
            "data": "PartNumber"
        }, {
            "data": "RFQ"
        }, {
            "data": "CreatedBy"
        }, {
            "data": "DateCreated"
        }]
    }
    

    The sName (or columns.name in 1.10 style) is really useful only for selectors (column-selector). I think it can be safely ignored here.

    Regards,
    Allan

  • Parker3306Parker3306 Posts: 3Questions: 1Answers: 0

    This did the trick perfectly. Thank you for the correction!

This discussion has been closed.