我有一个带有音调记录的表,我需要表中的一些链接,所以问题是格式化。。。
第一行是患者姓名到其单个页面的链接,最后一行是用于编辑和删除患者的链接集合。
问题:
- 现在,第一行中的代码不显示名称(行[1]),显示姓氏(第[2]行),但链接正常(第[0]行)
- 在最后一行中,两个链接都运行良好,但thickybox不正常工作时,链接会在新页面中打开
有人能帮我吗?提前感谢!!:)
服务器端处理脚本:
$columns = array(
array(
'db' => 'id',
'dt' => 0,
'formatter' => function( $d, $row ) {
$links='<a href="paciente/'.$row[0].'/0/">'.$row[1].'</a>';
return $links;
}),
array( 'db' => 'apellidos', 'dt' => 1 ),
array( 'db' => 'tel_mov', 'dt' => 2 ),
array( 'db' => 'terapeuta', 'dt' => 3 ),
array(
'db' => 'id',
'dt' => 4,
'formatter' => function( $d, $row ) {
$links2='<a href="print-historia.php?height=655&width=800&id='.$row[0].'&pacientes=si" class=" thickbox editar txt_petit"><img src="ima/edit.png" /></a> | <a href="?borrar=total&id='.$row[0].'" onClick="return confirmSubmit()" class="borrar txt_petit"><img src="ima/close.png" /></a>';
return $links2;
}),
);
Javascript:
$(document).ready(function() {
$('#tablet').DataTable({
"language": {
"url": "https://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"},
"scrollY": "400px",
"scrollCollapse": true,
"processing": true,
"serverSide": true,
"ajax": "load.php"
});
} );
我得到了;)
对于链接名称问题:
只需添加表的第一列aid数据,如果您不需要它,则使用javascript("bVisible":false)中的选项将其隐藏
所以现在$row[0]总是id,$row[1]是名称。。。
对于厚度箱问题:
只需在"fnDrawCallback"之后添加带有选项的"aoColumns"
"aoColumns": [
{ "sTitle": "id","bVisible": false},
{ "sTitle": "Nombre" },
{ "sTitle": "Apellidos" },
{ "sTitle": "Móbil","bSortable": false },
{ "sTitle": "Fijo","bSortable": false },
{ "sTitle": "Terapeuta","bSortable": false },
{ "sTitle": "Edición","bSortable": false,"bSearchable": false }],
"fnDrawCallback": function() {
tb_init('a.thickbox');
}
我不知道这是否是最好的方式,但对我来说很有效;)