Adding a non-database column in a server-side processing script

Adding a non-database column in a server-side processing script

guihamelguihamel Posts: 10Questions: 0Answers: 0
edited December 2012 in DataTables 1.9
Hi

I'm using a PHP/mysqli setup that is working (I built it using the example on the site). I'm displaying 4 columns taken from 2 tables and everything is good.

Now, I need to add a button that once you click it, it sends data to a form where the information can be changed and saved back to the database. I know that my function works since it was working prior to implement server-side dataTables.

So my script ends like this:

[code]
while ( $aRow = $rResult->fetch_assoc() ) {
$row = array();
for ( $i=0 ; $i<$iColumnCount ; $i++ ) {
if ( $aColumns[$i] != ' ' ) {
// General output
$row[] = $aRow[ $aColumns[$i] ];
}
}
$row[] .= "test";
//$row[] .= "Edit";
$output['aaData'][] = $row;
}
echo json_encode( $output );
[/code]

In the commented line is the button code that IS NOT getting parsed back to dataTables. IF I use a word (test in my example), everything is parsed correctly.

I have a feeling that I'm missing/forgetting something yet I can't pin point what it is.

I would gladly accept any hints/help that can get me back on track. Cheers!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > $row[] .= "test";

    Does that not generate a syntax error? Appending to a non-existent (new) array element?

    Failing that, it would be great if you could run the debugger over your table please.

    Allan
  • guihamelguihamel Posts: 10Questions: 0Answers: 0
    If I just add text through concatenation, it works (like the example with "test").

    I have a feeling it might be a conflict between the double quotes and the single quotes in the string I'm trying to pass.

    Also, here is the debugger link -> http://debug.datatables.net/iremuj
  • guihamelguihamel Posts: 10Questions: 0Answers: 0
    Btw, here's my initial declaration, if that can be of any help

    [code]

    $(document).ready(function(){
    var oTable = $('#FlagResults').dataTable({
    "bJQueryUI" : true,
    "bServerSide" : true,
    "sAjaxSource" : "data_generator.php",
    "aaSorting" : [[ 0, "desc"]],
    "sPaginationType" : "full_numbers"
    });
    })

    [/code]
This discussion has been closed.