r2ferna
Newbie
Posts: 21
|
|
« Reply #2 on: October 28, 2013, 11:33:05 AM » |
|
Thanks stworthy! I changed the field to string Fields.
Now I'm faced to another issue:
This function tries to apply, the changes made to an row, to some other datagrid rows.
function hacerCambioMasivo(rowIndex,rowData,rowChanges){ cMeP = true; var llaveControl = rowData.Menu + (rowData.SubMenu || ''); var rows = $('#dgP').datagrid('getRows'); $.each(rows, function(i,row) { var llaveRow = row.Menu + (row.SubMenu || ''); if (llaveRow == llaveControl) { $('#dgP').datagrid('beginEdit', i); $('#dgP').datagrid('updateRow',{ index: i, row: rowChanges, }); $('#dgP').datagrid('endEdit', i); } }); cMeP = false; }
Yeah! I get the rows changed and refreshed (with datagrid-updateRow method) but this piece of code:
function aceptaCambios() { var rowsCh = $('#dgP').datagrid('getChanges'); console.log(rowsCh.length, rowsCh); }
Only shows one (1) changed row!! (the row who originated the massive changes - the row on wich I clicked the changes) the rows changed by the function code arn't counted as changed!
What can I do for?
PD: the function is fired at datagrid's onAFterEdit : onBeforeEdit:function(rowIndex,rowData) { if (!cMeP) { var tipoMenu = investigaTipoMenu(rowData); if (tipoMenu != 'Opcion') { // Es Menu o SubMenu var msje = "¡Los cambios efectuados en este " + tipoMenu + " serán aplicados a TODAS las opciones de dicho " + tipoMenu + "."; $.messager.alert("Aviso", msje, "info"); } rowData.editing = true; updateActions(rowIndex); } }, onAfterEdit:function(rowIndex,rowData,rowChanges){ console.log("Changes for row ", rowIndex, rowChanges); if (!cMeP) { var tipoMenu = investigaTipoMenu(rowData); if (tipoMenu != 'Opcion') { // Es Menu o SubMenu hacerCambioMasivo(rowIndex, rowData, rowChanges); } rowData.editing = false; updateActions(rowIndex); } },
and this are the datagrid columns definitions:
<th field="p-vp" width="80" align="center" formatter="formatVer" editor="{type:'checkbox', options:{on:'Si', off:'No'}}">¿Ver?</th> <th field="p-gp" width="90" align="center" formatter="formatGuardar" editor="{type:'checkbox', options:{on:'Si', off:'No'}}">¿Guardar?</th>
MTIA.
|