I am trying to use this library that allows for inline table editing, and AJAX updates - well I've been having a ton of trouble figuring out how to communicate between it and my MySQL database that contains all the information contained in the rows.
Here's the code example provided:
Unless you just want people to dink around with the transient-by-nature current page, you'll probably want to define/override the InlineEditor.elementChanged function and do something that saves the user's changes. Here is an example using AJAX to immediately post a change. In this case, I used my handy ajax.js code to do it.
InlineEditor.elementChanged = function( theElement, oldVal, newVal )
{
mySavingIndicator( theElement );
var url = "http://www.myserver.com/update.php?id=" + cell.id + "&val="+newVal;
AJAX.getText( url, function( response ){
clearMySavingIndicator( theElement );
alert( 'Did the save work? ' + response );
}); // end ajax callback function
}; // end elementChanged
What I am really wondering about here is what is cell.id, is it normal Javascript, and what output does it give? How can I use this to allow my cells to be editable and go back to the database? My supervisor really wants inline editing and while I have been working in Javascript and with AJAX all week, it is very difficult for me to provide this to him!
I would think you'd have var url = "http://www.myserver.com/update.php?id=" + theElement + "&val="+newVal;
which, may BE the id of the cell being edited.
Or, you may have some existing object 'cell' that, in some 'didStartEditing' type of function, would have the id property set to reflect the element being edited