Creating an 'Update all Records' Button
Creating an 'Update all Records' Button
I'd like some newbie help please.
I have a dataTable which displays Person records. Each row contains a column for a 1-char field (possible values= Y/N).
I'd like to know the optimum way of placing a button on my table (or even just on the webpage!) which executes the MySQL "Update sourcetable set yesnoflag = 'N'" and then redisplays the table.
So far I have an extended TableTools 'ajax' button which calls a .php file. But although this successfully updates the underlying source table it gives an error: "Error detected when sending table data to server" and it does not refresh the table.
Any pointers to a solution would be appreciated. Apologies for not putting up my code, but I didn't want to prejudice any answers.
Thanks,
Pete.
I have a dataTable which displays Person records. Each row contains a column for a 1-char field (possible values= Y/N).
I'd like to know the optimum way of placing a button on my table (or even just on the webpage!) which executes the MySQL "Update sourcetable set yesnoflag = 'N'" and then redisplays the table.
So far I have an extended TableTools 'ajax' button which calls a .php file. But although this successfully updates the underlying source table it gives an error: "Error detected when sending table data to server" and it does not refresh the table.
Any pointers to a solution would be appreciated. Apologies for not putting up my code, but I didn't want to prejudice any answers.
Thanks,
Pete.
This discussion has been closed.
Replies
Allan
Refreshing the page shows that the source data has been updated.
How do I get the table to referesh automatically?
My PHP file is very simple: [code] include ('include/conn.php');
$sQuery = "UPDATE $app_players SET yesnoflag = 'N'";
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
echo json_encode($rResult); [/code]
My Button definition is: [code] { "sExtends": "ajax",
"sAjaxUrl": "test4.php",
"sButtonText": "test4"} [/code]
Allan
yes, it is Ajax sourced. I 'm using one of my Editor modules: DTE_players.
I tried this:[code] { "sExtends": "ajax",
"sAjaxUrl": "test4.php",
"sButtonText": "test1",
"fnComplete": function() {oTable.fnReloadAjax("DTE_players.php") }
} [/code]
but got a "oTable.fnReloadAjax is not a function" error message.
Allan
I have now and it works fine.
Thanks, for all the help.