到目前为止,我已经能够完成这个jsfiddle中显示的内容:
http://jsfiddle.net/Sk8erPeter/qjrJX/
我希望整个行只有一个提交按钮来提交所有值,无论它们是否已被编辑,以及整个行的单个取消按钮。
为简单起见,我们假设我的代码与上面列出的jsfiddle完全相同。一旦我知道如何完成它,我就可以相应地修改自己的代码。
$(document).ready(function () {
$(".charcounter").editable("http://www.appelsiini.net/projects/jeditable/php/save.php", {
indicator: "<img src='http://www.appelsiini.net/projects/jeditable/img/indicator.gif'>",
type: "charcounter",
submit: 'OK',
tooltip: "Click to edit...",
onblur: "ignore",
charcounter: {
characters: 60
},
event:'dblclick'
});
$('.edit_all_btns').click(function () {
$(this).parent().siblings("td").find('.edit').dblclick();
});
});
答案 0 :(得分:0)
我遇到了同样的问题。 这就是我所做的,Page Load我设置了一个值var EnableSubmit = False; 在任何编辑我设置EnableSubmit = True,并使“提交”按钮可见。
.makeEditable({
oEditableSettings:{event:'click'},
sUpdateURL:function(value,settings){
var RowID = oTable.fnGetPosition(this)[0];
var ColID = oTable.fnGetPosition(this)[2];
var sColumnTitle = oTable.fnSettings().aoColumns[ColID].sTitle;
return(UpdateCellData(RowID,sColumnTitle,value));
},
aoColumns:[
null,
null,
null,
{placeholder: ' ',cancel :'Cancel', submit:'OK',}, // Part Number (Allow Editing)
null, // Quanity
null, // UOM
null, // Date
{placeholder: ' ', cancel :'Cancel', submit:'OK',},
{placeholder: ' ',cancel :'Cancel', submit:'OK',},
null // Line Total
]
});
function UpdateCellData(RowId,ColumnName,NewValue)
{
if(ColumnName!="")
{
var AutoChangeCheck = false;
switch(ColumnName)
{
case "Number":
AutoChangeCheck = true;
TableData.Info.Items[RowId].Number = NewValue;
break;
case "Date":
AutoChangeCheck = true;
TableData.Info.Items[RowId].DateInput = new Date(NewValue).toDateString();
break;
case "Price":
AutoChangeCheck = true;
TableData.Info.Items[RowId].Price = NewValue;
break;
}
}
if(AutoChangeCheck)
{
// If Change is Valid show Change Request Button.
var elem = document.getElementById('Request_Change');
$(elem).show();
}
UpdateDataTable();
return NewValue;
}
这允许他们对整个表(以及扩展表,如果需要)进行所有更改
完成所有操作后,现在可以看到“Request_Change”按钮。点击我致电
function SendChageRequest()
{
// Send Change Request Query
var elem = document.getElementById('Request_Change');
$(elem).hide(); // Hide after Change Request Submitted so they don't double click.
//console.log("Send Without Files");
NameSpace.Content.ServerCalls.PushRequest(TableData.Info,OnCompleateChageRequest,OnError)
}