85 lines
1.5 KiB
JavaScript
85 lines
1.5 KiB
JavaScript
$(function() {
|
|
|
|
|
|
//alert($("#jobTableHead > tr > th").length);
|
|
|
|
/* var headerCols = $(".jobTableHead > tr > th");
|
|
|
|
|
|
headerCols.each(function(index) {
|
|
alert($(this).width);
|
|
});*/
|
|
|
|
|
|
$(".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() {
|
|
|
|
}
|