Nov 16, 2014, 2:42 AM
Re-enable grid after editor close on save without changes
Hello,
I'm facing a problem: I have a Window with a GridPanel with RowEditor definition. In it's BeforeEdit event I disable the close button of the window to prevent closing it during editing:
Grid's Plugin definition
What could I do to re-enable the grid and close buttons after Save without changes?
Thank you
Regards
Alex
I'm facing a problem: I have a Window with a GridPanel with RowEditor definition. In it's BeforeEdit event I disable the close button of the window to prevent closing it during editing:
Grid's Plugin definition
<Plugins>
<ext:RowEditor ID="rowEditorFuncAsoc" ErrorSummary="false" runat="server" SaveText="Guardar" CancelText="Cancelar" ErrorText="Advertencia" CommitChangesText="Antes de continuar debe guardar los cambios o cancelar.">
<Listeners>
<BeforeEdit Fn="deshabilitarFuncAsoc"/>
<ValidateEdit Fn="habilitarFuncAsoc" />
<CancelEdit AutoPostBack="false" Fn="deshabilitarFuncAsoc"/>
</Listeners>
<DirectEvents>
<AfterEdit OnEvent="agregarFuncionario">
<ExtraParams>
<ext:Parameter Mode="Raw" Name="n_fila" Value="Ext.encode(#{grdFuncAsoc}.getRowsValues({selectedOnly:true}))"></ext:Parameter>
<ext:Parameter Mode="Raw" Name="d_fila" Value="Ext.encode(#{grdDocumento}.getRowsValues({selectedOnly:true}))"></ext:Parameter>
</ExtraParams>
<EventMask MinDelay="250" ShowMask="true" />
</AfterEdit>
</DirectEvents>
</ext:RowEditor>
</Plugins>
Javascript functions to disable and enable window's close buttons and the grid itself: var habilitarFuncAsoc = function(){
$('input:hidden[name=inpAccion]').val('false');
Ext.getCmp('#{grdFuncAsoc}').setDisabled(false);
Ext.getCmp('#{btnCerrarAsoc}').setDisabled(false);
enableHide(Ext.getCmp('#{winFuncAsoc}'));
}
var deshabilitarFuncAsoc = function(editor, rowIndex){
Ext.getCmp('#{grdFuncAsoc}').setDisabled(true);
Ext.getCmp('#{btnCerrarAsoc}').setDisabled(true);
disableHide(Ext.getCmp('#{winFuncAsoc}'));
return true;
}
When I click the Cancel button in the row editor, or click the Save button with changes made, the grid and close buttons get enabled again. But if I click Save button without changes made to editors, the grid and buttons don't get enabled again because the function habilitarFuncAsoc is not called, ValidateEdit don't fire in this case, nor AfterEdit event.What could I do to re-enable the grid and close buttons after Save without changes?
Thank you
Regards
Alex