這是我第一次使用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