sUpdateUrl in makeEditable() function return Alert Box instead of Updating cell (PHP)
sUpdateUrl in makeEditable() function return Alert Box instead of Updating cell (PHP)
Having issues using the php back end. I am following your example precisely but am only getting an alert box containing the value I attempted to edit. The simple
[code] sUpdateURL: function(value, settings)
{
return(value);
}[/code]
works fine (of course not actually changing the data source), but the echo $value return the right value but in an alert box without changing the cell value of course. Any idea what I'm doing wrong? here is some of my code:
[code]
$(document).ready(function () {
$('#example2').dataTable({
"bPaginate": true,
"bProcessiong":true,
"bServerSide":true,
"iDisplayLength": 10,
"bAutoWidth": false,
"sPaginationType": "four_button",
"sAjaxSource": "Assets/Data/PackJSON.txt",
"aoColumns": [{ "bVisible": false }, { "bVisible": false }, null, null, null, null, null, null, null],
"sDom": 'Rlfrtip',
}).makeEditable({
sUpdateURL: "Updates/PackUpdate.php",
"aoColumns": [null, null, null, null, {
indicator: 'Saving...',
tooltip: 'Click to select town',
loadtext: 'loading...',
type: 'select',
onblur: 'submit',
data: "{'USPS':'USPS','UPS':'UPS','TNT':'TNT','USP2':'USP2','USP3':'USP3','USP15':'USP15','USP45':'USP45','USPS12':'USPS12'}"}, {}, {}]
//add a click event to every row in the table
});
});
}
[/code]
[code] sUpdateURL: function(value, settings)
{
return(value);
}[/code]
works fine (of course not actually changing the data source), but the echo $value return the right value but in an alert box without changing the cell value of course. Any idea what I'm doing wrong? here is some of my code:
[code]
$(document).ready(function () {
$('#example2').dataTable({
"bPaginate": true,
"bProcessiong":true,
"bServerSide":true,
"iDisplayLength": 10,
"bAutoWidth": false,
"sPaginationType": "four_button",
"sAjaxSource": "Assets/Data/PackJSON.txt",
"aoColumns": [{ "bVisible": false }, { "bVisible": false }, null, null, null, null, null, null, null],
"sDom": 'Rlfrtip',
}).makeEditable({
sUpdateURL: "Updates/PackUpdate.php",
"aoColumns": [null, null, null, null, {
indicator: 'Saving...',
tooltip: 'Click to select town',
loadtext: 'loading...',
type: 'select',
onblur: 'submit',
data: "{'USPS':'USPS','UPS':'UPS','TNT':'TNT','USP2':'USP2','USP3':'USP3','USP15':'USP15','USP45':'USP45','USPS12':'USPS12'}"}, {}, {}]
//add a click event to every row in the table
});
});
}
[/code]
This discussion has been closed.
Replies
[code]
<?php
...yada yada...
?>
[/code]
...is wrong - get rid of the training blank lines after the closing tag
[...] Function should return the SAME value that is posted - any other text will be shown as an error message [...].
e.g
post "TEST" , return "TEST"
echo $_REQUEST['value'];
But i still have the alert popup showing. There is a space appended to the return value
Fix: trim the values in jquery.dataTables.editable.js on line number 150.
if (sNewCellValue == sValue) {
to
if (sNewCellValue.trim() == sValue.trim()) {
Thank you!!! I've been banging my head into the desk for hours trying to figure this out. I wondered if it was a space situation, but didn't think about editing the datatables js. Your fix did the trick.
Thanks again