DataTables Error: “Requested unknown parameter”

前端 未结 5 1724
春和景丽
春和景丽 2020-12-06 04:54

I\'m new to the DataTables jquery plugin. After discovering that IE 8 had performance issues with Javascript I decided to change the way I use DataTables to do server side

相关标签:
5条回答
  • 2020-12-06 04:55

    I ran into the same warning as well, but the cause was different. I had null values in my data. The JSON format was correct, but DataTables does not know have a default rule for displaying nulls. The solution was to use the sDefaultContent property.

    Sample aaData:

    aaData: [
      { "Field1": "Foo", "Field2":null },
      { "Field1": "Bar", "Field2":null },
    ]
    

    And then on the aoColumns, you can use the property as follows:

    aoColumns: [
      { "mData": "Field1", sDefaultContent: "n/a" },
      { "mData": "Field2", sDefaultContent: "" }
    ]
    

    This is not your current problem, but you may encounter this issue in the future.

    Hope this was helpful.

    0 讨论(0)
  • 2020-12-06 04:56

    sDefaultContent option prevents displaying alert boxes only. Data tables wil not find the rule for displaying null values.

    Changing null values in the table will eliminate this warning..

    0 讨论(0)
  • 2020-12-06 04:59

    If it helps anyone I had a similar error because I had periods in my mRender function name:
    My.Namespace.MyFunction(data, row);

    This line:
    var a = _fnSplitObjNotation( src );

    Splits that into separate objects, which obviously generates an error.

    Using

    My_Namespace_MyFunction(data, row);

    Additionally I noticed this error when passing a string function name instead of the JavaScript function object.

    0 讨论(0)
  • 2020-12-06 05:11

    To avoid this error, your table number of "th" columns should equal to returning data columns(in numbers), in the above problem it is aaData.

    "aaData" : [ 
      [
       "person_id" : "888888",
       "ID" : "999999",
      ],
      [
       "person_id" : "8888889",
       "ID" : "9999990",
      ]
    ]
    

    This is correct format to return data from server side language. I have solved my problem in same way.

    0 讨论(0)
  • 2020-12-06 05:20

    I was having this same problem this morning. You need to have the aoColumns parameter and use mDataProp As in this:

    https://gist.github.com/1660712

    At least it solved my problem.

    0 讨论(0)
提交回复
热议问题