{ "bSortable": false, "fnRender": function(oObj){return "<a href='main.php?do=labour&action=edit&sid=" + oObj.aData[12] + "'>Edit</a>"; } }
当我单击编辑按钮时,我试图弹出。
这是我的gui
这是我的代码:
<script type="text/javascript" charset="utf-8">
var oTable;
/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
sOut += '<tr><td>Name:</td><td style="color:blue;">'+aData[3]+' '+aData[4]+' '+aData[5]+'</td></tr>';
sOut += '<tr><td>Tag ID:</td><td style="color:blue;">'+aData[1]+'</td></tr>';
sOut += '<tr><td>ID #:</td><td style="color:blue;">'+aData[2]+'</td></tr>';
sOut += '<tr><td>Course:</td><td style="color:blue;">'+aData[9]+'</td></tr>';
sOut += '<tr><td>Department:</td><td style="color:blue;">'+aData[7]+'</td></tr>';
sOut += '<tr><td>Contact:</td><td style="color:blue;">'+aData[8]+'</td></tr>';
sOut += '<tr><td>Address:</td><td style="color:blue;">'+aData[9]+'</td></tr>';
sOut += '<tr><td>Last Modified:</td><td style="color:blue;">'+aData[10]+'</td></tr>';
sOut += '</table>';
return sOut;
}
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php",
"aoColumns": [
{ "sClass": "", "bSortable": false },
null,
null,
null,
{ "sClass": "" },
{ "sClass": "" },
{ "bSortable": false, "fnRender": function(oObj){return "<a href='main.php?do=labour&action=edit&sid=" + oObj.aData[12] + "'>Edit</a>"; } //heres is my problem }
],
"aaSorting": [[1, 'asc']]
} );
$('#example tbody td img').live( 'click', function () {
var nTr = $(this).parents('tr')[0];
if ( oTable.fnIsOpen(nTr) )
{
/* This row is already open - close it */
this.src = "examples_support/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "examples_support/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
</script>
帮助我的代码从 MySQL 数据库动态显示 jQuery 弹出窗口。显示所有行的弹出窗口,但未显示相同的 id,即正确的 id 未传递到弹出窗口。任何人都可以建议我。