I needed to disable editing on my first and second columns.
I needed to disable editing on my first and second columns.
alderhernandez
Posts: 33Questions: 11Answers: 1
I in am adding rows to mi table dinamicly. but i need disable the editing in certain columns. how i do this??
thanks for the help
this is my code where i am add the new colums
$(document).ready(function() {
var t = $('#Tabla').DataTable();
$('#agregar').on( 'click', function () {
//var nColumnas = $("#Tabla th").length;
//var columnas = nColumnas-3;
var idEmp = document.getElementById('empleado');
var texto = $("#empleado option:selected").html();
var idemp = idEmp.value || '';
var bandera=0;
if (!idemp || !idemp.trim().length) {
alert('Debe seleccionar un Empleado');
return;
}
/**********aqui valido si el empleado ya esta agregado en la tabla,
*********comparando su ID en la tabla con el ID del select
******************************************************************/
else
{
$("#Tabla td").each(function (index)
{
var textCelda=$(this).text();
if (textCelda==idemp)
{
alert("Este empleado ya esta agregado");
bandera=1;
return false;
}
})
if (bandera == 0)
{
var res = texto.split("/");
var nombre = res[0] || '';
var cargo = res[1] || '';
//alert(bandera);
t.row.add([idemp,nombre,cargo]).draw(false);
idEmp.value = '';
}
}
editField: "users.site"
} );
} );
i need disable the first and second colums
This discussion has been closed.