jquery Datatables intialisation:
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: Data
[{"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"}]
I want to display 3columns. SMScontent, smsCategory, 3rd column with buttons
我想显示3列。 SMScontent,smsCategory,带按钮的第3列
when I am displaying the page getting Datatables warning, but when I click on "OK" button page is loading fine without any errror. Then why this warning is being displayed on refresh or pageload.
当我显示页面获取Datatables警告,但当我点击“确定”按钮页面加载正常没有任何错误。那么为什么在刷新或页面加载时会显示此警告。
Datatables is initialises on body onload function.
Datatables是body onload函数的初始化。
How to resolve this issue.
如何解决此问题。
1 个解决方案
#1
0
You either have less/more columns or you misspelled any of the column's names. Check if you are passing the column that you've defined on <th>
of <table>
.
您要么拥有更少/更多列,要么拼错任何列的名称。检查是否传递了在
上定义的列。 |
---|
#1
0
You either have less/more columns or you misspelled any of the column's names. Check if you are passing the column that you've defined on <th>
of <table>
.
您要么拥有更少/更多列,要么拼错任何列的名称。检查是否传递了在
上定义的列。 |
---|