1
如何使用hospitallName填充表的標題&在json數據中提供日期?從Json填充自定義標題
**預期輸出在這裏添加**
{
"sEcho":2,
"iTotalRecords":243,
"iTotalDisplayRecords":243,
"aaData":[
[
"Mark Zuckerberg",
"USA",
"Feb 14, 1943"
],
[
"John Mathew",
"UK",
"Feb 14, 1943"
],
[
"John Mathew",
"USA",
"Feb 14, 1943"
]
],
"Date":"Aug 01, 2016 - Aug 05, 2016",
"hospitallName":"Apollo Hospital Center"
}
-
在我的服務器端,我打電話這樣,
$(document).ready(function() {
oTable = $('#report').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bServerSide": true,
"bProcessing":true,
"bFilter":true,
"oLanguage": {
"sProcessing": "Please wait..."
},
"sAjaxSource": "myDataTableAction.action",
"aaSorting": [],
});
$('td.options span').hide();
$('<caption/>').html('<h2 style="text-align: center;background-color:#f9b660 !important ; line-height: 45px;">Have to show hosital Name & Date here</h2>').appendTo('#report');
});
我想過去「'myDataTableAction .action「以struts.xml.getting結果爲Json格式,在這種情況下,我也可以使用」ajax「而不是」sAjaxSource「? – kavie
@dya,你可以試試嗎? :)'sAjaxSource'實際上只是'ajax'的簡稱(如果它是一個字符串.i.e url)或一個對象字面量(如果您需要控制AJAX請求和響應)的匈牙利符號名稱。所以他們是一樣的。 – davidkonrad
如果我使用ajax,動作傳遞爲null, http:// localhost:8080/Hospital/web/null?sEcho = 1&iColumns = 9&sColumns =&iDisplayStart = 0&iDisplayLength = 10 – kavie