I have a simple grid layout I wrote using jQuery. I have one problem. I want to allow only one edit row at a time. So I keep track of current editing row and reset it on next edit button is clicked. Still when I click edit for next time it allows me edit. completeEdit works fine cause I am also calling it from cancel button by passing current row.
var currentRowEdit =null;
$(tableid + ".edit").live('click', function(event) {
currentRowEdit = $(this).parent().parent();
editRow(currentRowEdit);
});
function editRow(row){
if(currentRowEdit!=null){
completeEdit(currentRowEdit);
}
$(row).find(".save").show();
$(row).find(".cancel").show();
$(row).find(".edit").hide();
}
function completeEdit(row){
$(row).find(".save").hide();
$(row).find(".cancel").hide();
$(row).find(".edit").show();
}