Set column value to a link - PHP example code
Set column value to a link - PHP example code
Hello!
I've been working with your Datatables for a few days now and I have to say kudos! It's truly a fantastic piece of code :)
I've been trying to sort out a problem, I know enough PHP and javascript to be dangerous but maybe I don't know enough yet to make this work.
I'm using the example PHP code for server side data and I need one of the column's values to be a link to an edit form. I've been trying to get this functionality to work using this:
[code]
"fnInitComplete": function ( oSettings ) {
$(oTable.fnGetNodes()).click( function () {
var iPos = oTable.fnGetPosition( this );
var aData = oSettings.aoData[ iPos ]._aData;
location.href=('edit-projects.php?projectID='+aData[0]);
} );
}
[/code]
But I would actually rather just have one of the values come back from the server as a link instead!
I know it would probably have to be done somewhere near this codeblock:
[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i
[/code]
Again, I'm not a PHP expert by any means, but I've played around with something like:
[code]
$aRow[5] = '
I've been working with your Datatables for a few days now and I have to say kudos! It's truly a fantastic piece of code :)
I've been trying to sort out a problem, I know enough PHP and javascript to be dangerous but maybe I don't know enough yet to make this work.
I'm using the example PHP code for server side data and I need one of the column's values to be a link to an edit form. I've been trying to get this functionality to work using this:
[code]
"fnInitComplete": function ( oSettings ) {
$(oTable.fnGetNodes()).click( function () {
var iPos = oTable.fnGetPosition( this );
var aData = oSettings.aoData[ iPos ]._aData;
location.href=('edit-projects.php?projectID='+aData[0]);
} );
}
[/code]
But I would actually rather just have one of the values come back from the server as a link instead!
I know it would probably have to be done somewhere near this codeblock:
[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i
[/code]
Again, I'm not a PHP expert by any means, but I've played around with something like:
[code]
$aRow[5] = '
This discussion has been closed.
Replies
[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i
[/code]
Allan
worked great!
Just had to add the value to the link:
[code]
$row[] = '' . $aRow[$aColumns[$i]] . '';
[/code]