这是我第一次使用JS,所以我真的不知道我在做什么。jQuery/jEditable和jQuery UI对话框。重新填充表格单元格
我有一个数据表,并使用jEditable允许用户编辑数据并将其发布到我的PHP脚本。当用户点击“保存”时,它会用php脚本中的数据打开jQuery UI,但它似乎工作正常,但是,如果用户点击取消或Esc关闭jQuery UI对话框,它们又回到页面上,但是他们试图编辑的单元格现在完全是空的。我如何让细胞重新填充?
谢谢!
$(".editable_textarea").editable("/path/to/my/script.php", {
indicator : "<img src='/images/indicator.gif'>",
type : 'textarea',
submitdata: { _method: "post", uri: "<?php echo $this->uri->segment(3); ?>" },
select : false,
submit : 'Save',
cancel : 'Cancel',
tooltip : "Click to edit...",
cssclass : "editable",
onblur: "cancel",
cssclass: "edit_destination",
callback:
function(value, settings) {
$(this).dialog({
autoOpen: true,
width: 400,
modal: true,
position: "center",
resizable: false,
draggable: false,
title: "Pending Changes",
buttons: {
"Cancel": function() {
$(this).dialog("close"); },
"Confirm Changes": function() {
document.findSameDestination.submit(); }
}
});
$('form#findSameDestination').submit(function(){
$(this).dialog('open');
return false;
});
$(this).editable("disable");
},
data:
function(value, settings) {
var retval = value.replace(/<br[\s\/]?>/gi, '\n');
retval = retval.replace(/(<([^>]+)>)/gi, '');
return retval;
}
});
仍然不知道如何解决这个问题,我没有足够的积分以提供赏金......
也许我应该将原始数据保存为临时变量,然后将其写回到表格单元格中取消?我处于亏损状态。 – solefald 2010-04-15 21:12:18