我正在嘗試數據表。我成功嘗試了Ajax調用。但現在我正在尋找加載我的數據網格,當然,在頁面加載時使用數據表。如何將數據手動傳遞給數據表
我需要通過查詢字符串將參數傳遞給我的處理頁面。頁面執行操作,然後模板文件顯示數據網格。這一切都是在smarty中使用手動foreach和其他循環完成的。現在我想將它全部轉換爲數據表。
但是,如何將最初的數據傳遞給數據表?因此我需要將初始數據傳遞給數據表,但是如何?我提到數據表api和其他引用,但沒有任何這樣的事情。請幫助
我謹grid.tpl
<html>
<head>
<script src="jq.js"></script>
<script src="datatables.js"></script>
</head>
<body>
<script>
var data = '<?php echo $dbRet?>'; //now i got data here
$('#one-column-emphasis').dataTable({
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "changeLog.php",
"bPaginate" : true,
"aoColumns" : [ "Topic", "Details", "Date" ],
"aaSorting" : [[1,"desc"]]
}); // how to pass $dbRet to this handler????
</script>
<table id="one-column-emphasis">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
您是否使用smarty函數來訪問數據庫(如someDbOps($ someGetParams); sugests或php函數,IE,mys ql_query(); – Bradmage 2012-04-04 11:18:30
這只是一個示例代碼片段,我在那裏寫的東西。這是一個PHP函數。 – Shades88 2012-04-04 11:28:20