jquery-tabledit
jquery-tabledit copied to clipboard
how to use plugin like datepicker etc to 1 spesific field in tabledit
i was trying to call datepicker in 1 field but plugin not show and im using datatable. thanks for help
this is code i create `$('#btn-submit').click(function() { //var number = $('#Object_number').val(); var target = $(this).attr('data-type'); var postdata = { name: $('#customer').val(), hangar: $('#hangar').val(), line: $('#line').val() };
if($('#customer').val() == '' || $('#hangar').val() == '' || $('#line').val() == '') {
$('#btn-submit').attr('type', 'submit');
}
else {
$('#btn-submit').attr('type', 'button');
$.ajax({
type: 'POST',
url: base_url+'index.php/oven_cm_em/'+target+'/listSwift',
data: postdata,
cache: false,
dataType: 'json',
beforeSend: function() {
$('#btn-submit').attr('disabled', true);
$('#btn-submit-txt').text('Processing . . .');
initTable.fnClearTable();
$('.panel-refresh').click();
},
success: function(data) {
setTimeout(function(){
$('#btn-submit').attr('disabled', false);
$('#btn-submit-txt').text(' Show Data');
initTable.fnAddData([
'<input type="checkbox" class="tc" id="checkbox" name="SMR_Main_WorkCtr[]" value="'+data+'" /><span class="labels"></span>',
1,
data,
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">',
'<input class="form-control" autocomplete="off" style="width:150px;" type="text" name="'+data+'">'
]);
}, 1000);
}
});
}
}); $('table tr').editable({ edit: function(values) { $(".edit i", this) .removeClass('fa-pencil') .addClass('fa-save') .attr('title', 'Save'); }, save: function(values) { $(".edit i", this) .removeClass('fa-save') .addClass('fa-pencil') .attr('title', 'Edit');
var id = $(this).data('id');
$.post(base_url+'index.php/'+F.uri_segment(1)+'/listEdit/'+id, values, function(response) {
if (response == 1) {
$('html, body').animate({ scrollTop: 0 }, 'fast');
$('#message').fadeIn('slow');
$('#message').addClass('alert-success');
$('#message').text('Data berhasil diperbaharui');
setTimeout(function() {
$('#message').hide('fast');
$('#message').removeClass('alert-success');
$('#message').text('');
window.location = current_url;
}, 2000);
}
else {
$('html, body').animate({ scrollTop: 0 }, 'fast');
$('#message').fadeIn('slow');
$('#message').addClass('alert-danger');
$('#message').text('Update gagal. Cek kembali');
setTimeout(function() {
$('#message').hide('fast');
$('#message').removeClass('alert-danger');
$('#message').text('');
window.location = current_url;
}, 2000);
}
});
//console.log(id, values);
},
cancel: function(values) {
$(".edit i", this)
.removeClass('fa-save')
.addClass('fa-pencil')
.attr('title', 'Edit');
}
});`