Hi partners, i have a doubt in the method validaterow for one datagrid, in this example
http://www.jeasyui.com/forum/index.php?topic=4165.msg9926#msg9926 one column appear with two datetime inputs avoiding missing datetimes:
The fisrt datetime must be less than the second date, the validator works fine and send tooltip error but when i click to another row in datagrid the missing row appears active and the new clicked row is activated to edit in, i have singleSelect on true
How to avoid this situation?
This is my code
<table id="ejec_tt_eventos"
class = "easyui-datagrid"
style="width: 770px;"
data-options="
title : 'Agenda de Eventos',
autoLoad : true,
fitColumns : false,
pagination : false,
striped : true,
singleSelect : true,
//onAfterEdit : acceptEjec,
collapsible : false,
onAfterEdit: function(rowIndex, rowData,changes) {
alert('Despues de la edicion');
console.log(changes);
},
onBeforeEdit: function(rowIndex, rowData) {
if (rowData.padre == 1 ){
return false;
} else {
return true;
}
}"
>
<thead>
<tr>
<th field= "id" width="20" hidden="true">ID</th>
<th field= "id_evento" width="20">ID</th>
<th field= "id_usuario" width="40" hidden="true">ID Usuario</th>
<th field= "rpe" width="40" hidden="true">RPE Usuario</th>
<th field= "desc_evento" width="160">Evento</th>
<th field= "fecha_ini_prog" width="125" align="center">Fecha Inicio Prog.</th>
<th field= "fecha_fin_prog" width="125" align="center">Fecha Termino Prog.</th>
<th field= "fecha_real_rango" width="250" align="center" editor="{type:'datetimeboxrange',options:{validType:'dateRangeCheck',editable:false,currentText:'Hoy',closeText:'Cerrar',okText:'Aceptar',showSeconds:false}}">Fecha Ejecución</th>
<th field= "padre" width="80" formatter="formatItemClock_grid" editor="{type:'checkbox', options:{on: '1', off: '0'}, required:true}">Realizado</th>
</tr>
</thead>
</table>
And it is for control edition
var editIndexEjec = undefined;
function endEditingEjec() {
alert('Terminando la edición editIndexEjec:' + editIndexEjec);
if (editIndexEjec == undefined) {
return true;
}
if ($('#ejec_tt_eventos').datagrid('validateRow', editIndexEjec)) {
$('#ejec_tt_eventos').datagrid('endEdit', editIndexEjec); //Finaliza Edicion
editIndexEjec = undefined;
return true;
} else {
return false;
}
}
$(function () {
var lastIndexEjec;
$('#ejec_tt_eventos').datagrid({
onClickRow: function (rowIndex, row) {
alert('Iniciando Edicion en el renglon ' + rowIndex)
if (lastIndexEjec != rowIndex) {
$('#ejec_tt_eventos').datagrid('endEdit', lastIndexEjec);
$('#ejec_tt_eventos').datagrid('beginEdit', rowIndex);
setEditingEjec(rowIndex, row);
renglon = rowIndex;
}
lastIndexEjec = rowIndex;
renglon = rowIndex;
}
});
});
function setEditingEjec(rowIndex, row) {
var editors = $('#ejec_tt_eventos').datagrid('getEditors', rowIndex);
alert('en SetEditing del renglon ' + rowIndex);
if (row.padre == undefined || row.padre == '0') {
$(editors[0].target).focus();
} else {
endEditingEjec();
}
}
function acceptEjec() {
if (endEditingEjec()) {
$('#ejec_tt_eventos').datagrid('acceptChanges');
}
}
function cancelrowEjec(target) {
$('#ejec_tt_eventos').datagrid('cancelEdit', getRowIndex(target));
}
function editrowEjec(target) {
$('#ejec_tt_eventos').datagrid('beginEdit', getRowIndex(target));
}
function removeitEjec() {
$.messager.confirm('Confirmar', '¿Esta seguro de eliminar el registro?', function (r) {
if (r) {
$('#ejec_tt_eventos').datagrid('cancelEdit', renglon).datagrid('deleteRow', renglon);
editIndexEjec = undefined;
}
});
}
function rejectEjec() {
$('#ejec_tt_eventos').datagrid('rejectChanges');
editIndexEjec = undefined;
}
Thanks in advance