this is the file I have in the jeditable java script initialisation as "server_processing_post.php
"[code]<?php
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array ( 'id', 'product_name', 'price', 'taxable_goods', 'details', 'category', 'subcategory', 'ship_weight', 'sale_price');
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";
You might want to edit that comment to remove your Database login information :-)
It doesn't explain where $id is coming from though - which is there you are getting the error. Were are you assigning $id to a MySQL result.
Actually - given that you are using server-side processing - you don't need that at all. Just remove everything from inside the table's tbody tag (i.e. the do {} while() loop).
Ok I removed the stuff from and the assoc so no more errors but now when I go to edit a row it
and I am trying this new post php script more similar to the editable_ajax.php
"[code]
<?php
if (isset($_POST["value"]))
$db_host = "*****";
// Place the username for the MySQL database here
$db_username = "*****";
// Place the password for the MySQL database here
$db_pass = "*****";
// Place the name for the MySQL database here
$db_name = "*****";
// Run the actual connection here
mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
mysql_select_db("$db_name") or die ("no database");
Given that 'row_id' is being sent, $id = $_POST["id"]; looks a bit suspect to me. Is there a reason you are using that, rather than $id = $_POST["row_id"];?
Ok so I know that it is sending the "row_id" and it is sending the "value" that I am typing into jeditable....for the POST to receive but there is an "id" being submitted as well but it is blank with no value. I figure I have to tell the database wich row_id it is and which cell "ie product_name, price ect.." to put the newvalue into maybe i am confusing the db?
the php script is working
Once i got the Value and the row id varibles going I had to add a column atribute to the jquery so i could create
a if ifelse column condition but know it works .....
Thanks I learned some neat stuff and accomplished my goal!
Would I be able to use row details API along with my server side jeditable table really I just want to add in an image pop up but my images are not stored in the data base they are in a file on the server....
The key thing here is to not apply the jEditable handler to the column you want the row details icon on (usually the first). Then you should be able to use the code given more or less as is. Try this for the selector: $('td:gt(0)', this.fnGetNodes())
I'm not certain that will work - you might need a loop over the TR nodes and then do the above, but that's the general idea :-)
$('td:gt(0)', this.fnGetNodes()) in the code you've got above doesn't do anything :-)
Add it in place of $('td', this.fnGetNodes()), which is what I was trying to say - sorry I wasn't clear enough. If that doesn't work (i.e. it might only stop the first TD in the whole table - I can't quite remember how jQuery works here) you'd need to put in something like: $(this.fnGetNodes()).each( function () { $('td:gt(0)', this).editable....
Replies
"[code]<?php
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array ( 'id', 'product_name', 'price', 'taxable_goods', 'details', 'category', 'subcategory', 'ship_weight', 'sale_price');
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";
/* DB table to use */
$sTable = "products";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
die( 'Could not open connection to server' );
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
die( 'Could not select database '. $gaSql['db'] );
/*
* Paging
*/
$sLimit = "";
if ( isset( $_POST['iDisplayStart'] ) && $_POST['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_POST['iDisplayStart'] ).", ".
mysql_real_escape_string( $_POST['iDisplayLength'] );
}
/*
* Ordering
*/
if ( isset( $_POST['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i
It doesn't explain where $id is coming from though - which is there you are getting the error. Were are you assigning $id to a MySQL result.
Actually - given that you are using server-side processing - you don't need that at all. Just remove everything from inside the table's tbody tag (i.e. the do {} while() loop).
Allan
and I am trying this new post php script more similar to the editable_ajax.php
"[code]
<?php
if (isset($_POST["value"]))
$db_host = "*****";
// Place the username for the MySQL database here
$db_username = "*****";
// Place the password for the MySQL database here
$db_pass = "*****";
// Place the name for the MySQL database here
$db_name = "*****";
// Run the actual connection here
mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
mysql_select_db("$db_name") or die ("no database");
#GET POST'D VALUES
$id = $_POST["id"];
$value = $_POST["value"];
$sql=mysql_query("UPDATE products SET product_name='$value', price='$value', category='$value', subcategory='$value', details='$value', sale_price='$value', ship_weight='$value', taxable_goods='$value' WHERE id='$id'");
echo $value.' (updated)';
?>
[/code]"
Allan
the php script is working
Once i got the Value and the row id varibles going I had to add a column atribute to the jquery so i could create
a if ifelse column condition but know it works .....
Thanks I learned some neat stuff and accomplished my goal!
now How can I get the row_details script to blend into this Script?
"[code]$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "server_processing.php",
"sPaginationType": "full_numbers",
"fnDrawCallback": function () {
//alert( 'Number of rows: '+ this.fnGetNodes() );
$('td', this.fnGetNodes()).editable( 'editable_ajax.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
//alert( 'Got ID of: '+oTable.fnGetData( this.parentNode )[0] );
return { "row_id": oTable.fnGetData( this.parentNode )[0],
"column": oTable.fnGetPosition( this )[2]};
},
"height": "14px"
} );
}
});
});
[/code]"
I'm not certain that will work - you might need a loop over the TR nodes and then do the above, but that's the general idea :-)
Allan
"[code]
$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "server_processing.php",
"sPaginationType": "full_numbers",
"fnDrawCallback": function () {
$('td:gt(0)', this.fnGetNodes())
//alert( 'Number of rows: '+ this.fnGetNodes() );
$('td', this.fnGetNodes()).editable( 'editable_ajax.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
//alert( 'Got ID of: '+oTable.fnGetData( this.parentNode )[0] );
return { "row_id": oTable.fnGetData( this.parentNode )[0],
"column": oTable.fnGetPosition( this )[2]};
},
"height": "16px"
} );
}
});
});[/code];
Add it in place of $('td', this.fnGetNodes()), which is what I was trying to say - sorry I wasn't clear enough. If that doesn't work (i.e. it might only stop the first TD in the whole table - I can't quite remember how jQuery works here) you'd need to put in something like: $(this.fnGetNodes()).each( function () { $('td:gt(0)', this).editable....
Allan