Jquery Datatables警告说未知参数

时间:2014-01-31 06:25:30

标签: jquery jsp datatables struts-1

jquery数据表初始化:

 var extensions = {
            "sFilter": "dataTables_filter manage_custom_filter_class",
            "sLength": "dataTables_length manage_custom_length_class",
            "sWrapper": "dataTables_wrapper",
            "sStripeOdd": "dataTables-odd-row",
            "sStripeEven ": "dataTables-even-row"
        }
  $.extend($.fn.dataTableExt.oJUIClasses, extensions);
  $(".manage-sms-template-table").dataTable({
         "sDom": 'T<"clear">lfrtip',
      "sPaginationType": "full_numbers",
      "bJQueryUI": true,
      "bProcessing": true,
      "sAjaxDataProp":"",
      "sAjaxSource": "notification.do?method=getSmsData",
      "aoColumns": [
                  { "mDataProp": "smsCategory", "bSortable": true, "sClass": "manage-sms-row-category"},
                  { "mDataProp": "smsContent", "bSortable": true, "sClass": "manage-sms-row-content" },
                  {"mDataProp": null,
                      "sClass": "manage-sms-row-buttons" ,
                      "fnRender": function (oObj) {
                          return '<div class="manage-sms-row-buttons-edit"><a href="notification.do?method=showEditSmsTemplate&id='+oObj.aData["smsTemplateId"]+'"><i class="fa fa-edit"></i></a> </div>'+
                        '<div class="manage-sms-row-buttons-view"><a href="notification.do?method=showEditSmsTemplate&type=view&id='+oObj.aData["smsTemplateId"] +'"><i class="fa fa-file-text-o"></i></a></div>'+
                        '<div class="manage-sms-row-buttons-delete"><a href="notification.do?method=deleteSMSTemplate&id='+oObj.aData["smsTemplateId"] +'"><i class="fa fa-trash-o"></i></a></div>'
                    }}
              ],
     "oTableTools": {
         "sSwfPath": "<%=request.getContextPath()%>/js/dataTables/swf/copy_csv_xls_pdf.swf",
         "aButtons": [
                      {
                          "sExtends": "csv",
                          "mColumns": [ 0, 1]
                      },
                      {
                          "sExtends": "xls",
                          "mColumns": [ 0, 1]
                      },
                      {
                          "sExtends": "pdf",
                          "mColumns": [ 0, 1]
                      },
                  ]
      },
      "aaSorting": [[ 1, "desc" ]]
  });

Json:数据

[{"smsTemplateId":2,"smsContent":"Test Template","smsCategory":"category1:changes"},
{"smsTemplateId":3,"smsContent":"Test Template 3","smsCategory":"category2:Updates"},
{"smsTemplateId":4,"smsContent":"Test Template 4","smsCategory":"category3:Changes"}]

我想显示3列。 SMScontent,smsCategory,带按钮的第3列

当我显示页面获取Datatables警告时,但是当我点击“确定”按钮页面加载正常时没有任何错误。那么为什么在刷新或页面加载时会显示此警告。

enter image description here

数据表是body onload函数的初始化。

如何解决此问题。

1 个答案:

答案 0 :(得分:0)

您要么拥有更少/更多列,要么拼错任何列的名称。检查您是否通过了<th> <table>上定义的列。