2
我想在所有的數據表我都空單元格定義默認值,但我不希望像每列做到這一點:數據表的默認渲染功能空單元
$('#example').dataTable({
"ajaxSource": "sources/deep.txt",
"columns": [
{ "data": "engine"
"render": function (data, type, row) {
if(row.platform == null) {
return "-";
} else {
return row.platform.display;
}
},
},
{ "data": "browser",
"render": function (data, type, row) {
if(row.platform == null) {
return "-";
} else {
return row.platform.display;
}
},
},
{
"data": "platform",
"render": function (data, type, row) {
if(row.platform == null) {
return "-";
} else {
return row.platform.display;
}
},
}
]
});
有一個機會來定義這個數據表默認值?我應該怎麼做?或者有更好的地方爲空單元定義這個渲染默認動作?
/* default values for tables */
$.extend(true, $.fn.dataTable.defaults, {
dom: "<'table_scroll_container't>" + "<'dt-row dt-bottom-row'<'col-md-4 m-b-10 h30 no-margin-md text-center text-md-left'B i><'col-md-8 m-b-10 h30 no-margin-md text-center text-md-right'l<'clearfix visible-xs-block visible-sm-block'>p>>",
buttons: [],
stateSave: true,
stateDuration: -1,
iDisplayLength: 50,
autoWidth: false,
processing: true,
language: {
"processing": "Processing...",
"info": "Showing _TOTAL_ entries",
"infoEmpty": "No records available",
"infoFiltered": "filtered from _MAX_"
}
});
所有其他提示,歡迎:)
你在這裏:https://datatables.net/reference/option/columns.defaultContent –