75 lines
1.3 KiB
JavaScript
75 lines
1.3 KiB
JavaScript
$(function() {
|
|
|
|
|
|
// $(".editButton").show();
|
|
|
|
|
|
|
|
$(".editButton").live('click',function() {
|
|
|
|
var id = $(this).parents('tr').attr('id');
|
|
getEditable(id);
|
|
|
|
return false;
|
|
});
|
|
|
|
|
|
$(".cancelButton").live('click',function() {
|
|
|
|
var id = $(this).parents('tr').attr('id');
|
|
getViewable(id);
|
|
|
|
return false;
|
|
});
|
|
|
|
|
|
$(".saveButton").live('click',function() {
|
|
var id = $(this).parents('tr').attr('id');
|
|
var thisJobInputs = $('#'+id).find('input,select');
|
|
|
|
$.post('/jobs/ajax_edit', thisJobInputs, function(data) {
|
|
getViewable(id);
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
//console.profileEnd();
|
|
|
|
});
|
|
|
|
|
|
function getEditable(id) {
|
|
$.get('/jobs/getEditableRow/'+id+'/editedRowCount', false, function(data) {
|
|
|
|
$("#"+id).replaceWith(data);
|
|
$("#"+id).find("button").button();
|
|
var tempHeader = $("#originalHeader").clone();
|
|
tempHeader.attr('class', 'tempHeader');
|
|
$("#"+id).before(tempHeader);
|
|
|
|
} );
|
|
}
|
|
|
|
|
|
function getViewable(id) {
|
|
$.get('/jobs/getViewableRow/'+id, false, function(data) {
|
|
|
|
$("#"+id).replaceWith(data);
|
|
$("#"+id).find("button").button();
|
|
$('.tempHeader').remove();
|
|
} );
|
|
}
|
|
|
|
function cancelEditable(id) {
|
|
$("#"+id).find('input').attr("readonly","readonly");
|
|
$("#"+id).find('select').attr("disabled","disabled");
|
|
$(".editButton").show();
|
|
}
|
|
|
|
|
|
function getParent() {
|
|
|
|
}
|