Ho provato un plugin ancora poco documentato ma che promette bene… anche perchè fa poco. quello che serve.
Ho appena scritto all’autore per capire se il mio “workaround” per salvare il dato modificato è inutile.
Non ho trovato metodi nativi per farlo.
Il plugin è reperibile qui:
http://gregweber.info/projects/uitableedit.html
Ho modificato giusto questo (riga 57).
Da
if( options.editDone ) options.editDone(val,orig_text, this)
A
if( options.editDone ) options.editDone(val,orig_text)
Per salvare la riga ho scritto questo:
jQuery(document).ready(function(){
jQuery(".tablesorter").tablesorter();
var t = jQuery('#tablesorter-demo');
jQuery.uiTableEdit( t ,
{
editDone : function(val,orig_text,el){
//console.log(val);
//console.log(orig_text);
//console.log(jQuery(el).parent().find(".key").text());
var thead = jQuery("thead>tr>",t);
//console.log(thead);
var row = jQuery(el).parent().children();
var data = [];
//console.log(row);
row.each(
function(nr){
var key = thead.eq(nr).text().replace(" ","_");
data.push(key + "=" + escape(jQuery(this).text()));
}
);
//console.log(data);
jQuery.ajax({
type: "POST",
url: "./include/server.php",
data: data.join("&"),
success: function(msg){
console.log(msg);
}
});
}
}
); // returns t
});
Ecco la Demo. Aprire con firebug attivo.
Popularity: 16% [?]

4 Comments
Ecco la risposta di greg
Ho corretto aggiornando l’ultima versione del plugin (0.4).
La callback era stata corretta da Greg
Hello,
I also have the problem with the padding/margin after I am done editing a cell.
Has anyone found a workaround or a bugfix for that problem?
Best regards
dailez
Hi folks,
I really love this script. Had to rewrite the php part for saving from the scratch but it works really nice now.
I succeeded in fixing the problem with the missing cell padding after editing a cell by adding “!important” to the td selector in the style.css. The code should look like this:
table.tablesorter tbody td {
color: #3D3D3D;
padding: 4px !important;
background-color: #FFF;
vertical-align: top;
}
One Trackback
[...] serverseitig erfolgen. Es haben sich aber schon andere Leute damit auseinandergesetzt. Der Ansatz http://maxb.net/blog/2008/05/08/uitableedit-save-data/ hat mich inspiriert zu einer eigenen Lösung, die ich für ein Projekt [...]