[英]Data Table Server Side Processing
嗨,我正在使用Datable服务器端处理,
$(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的值应根据我们进行更改
好吧,我使用另一种方法自己看,这是旧数据表的服务器端脚本
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>
';
}
}
}
我使用mRender获得了解决方案,我们可以解决这个问题
{"mData" : "organizationId",
"mRender": function ( data, type, full ) {
return '<a href="'+data+'">Download</a>';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.