您好我正在使用可数据服务器端处理
$(document).ready(function() {
$("#TABLE").dataTable({
"bProcesing" : true,
"bServerSide" : true,
"bLenthChange" : false,
"iDisplayLength" : 10,
"bSort":false,
"bFilter": true,
"sAjaxSource" : "/easdaspp/abc",
"aoColumns" : [
{
"sTitle" : "Organization Name",
"mData" : "organizationName"
},
{
"sTitle" : "Delete",
"sDefaultContent" : '<a href="abc/{organizationId}" >Delete</a>'
}],
"fnServerData" : function(sSource, aoData, fnCallback) {
$.ajax({
"dataType" : 'json',
"type" : "GET",
"url" : sSource,
"data" : aoData,
"success" : fnCallback
});
},
"sPaginationType" : "full_numbers"
});// dataTable
});
如何在锚标记中获得organizationId值 像这样
"sDefaultContent" : '<a href="abc/{organizationId}" >Delete</a>'
应该是
<a href="abc/1" >Delete</a>
对于每一行,url的值应该根据我们改变
答案 0 :(得分:1)
我使用mRender获得了解决方案,我们可以对此进行排序
{"mData" : "organizationId",
"mRender": function ( data, type, full ) {
return '<a href="'+data+'">Download</a>';
}
答案 1 :(得分:1)
我使用另一种方法看看自己 这是旧数据表的服务器端脚本
static function data_output($columns, $data) {
$out = array();
for ($i = 0, $ien = count($data); $i < $ien; $i++) {
$row = array();
for ($j = 0, $jen = count($columns); $j < $jen; $j++) {
$column = $columns[$j];
if ( $aColumns[$i] == "cId" ){
/* Special output formatting for 'cId' column */
$row[] = '
<div id="trigger">
<a target="_blank" title="Click to make Payment" href="viewDetails.php?cId='.$aRow[$aColumns[$i]].'">
<img src="images/icons/color/rupee.png" />
</a>
</div>
';
}
}
}