Cancel insertion or editing of gridpanel

  1. #1

    Cancel insertion or editing of gridpanel


    I have a gridpanel that displays a window to insert new record. It's working.
    But I have a cancel button only closes the window, I need data gridpanel be canceled by clicking this button


    Following partial code:

        Title="Cadastro de Produtos"
                  <ext:FormPanel ID="FormPanel1" runat="server" Title="Form Panel" Padding="5" ButtonAlign="Right">
                                    <ext:TextField ID="COD_PRODUTO" DataIndex="COD_PRODUTO" runat="server" FieldLabel="Código" AnchorHorizontal="95%" />
                                    <ext:TextField ID="DESCRICAO" DataIndex="DESCRICAO" runat="server" FieldLabel="Descrição" AnchorHorizontal="95%" />
                                    <ext:TextField ID="PRECO_CUSTO" DataIndex="PRECO_CUSTO" runat="server" FieldLabel="Preço Custo" AnchorHorizontal="95%" />
                                    <ext:TextField ID="PRECO_VENDA" DataIndex="PRECO_VENDA" runat="server" FieldLabel="Preço Venda" AnchorHorizontal="95%" />
                                    <ext:ComboBox ID="COD_MARCA2" runat="server" DataIndex="COD_MARCA" StoreID="Store2" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="DESCRICAO"  ValueField="COD_MARCA" EmptyText="Carregando..."  ValueNotFoundText="Carregando..."/>
                                    <ext:Button ID="Button10" runat="server" Text="Salvar">
                                           <Click Handler="#{FormPanel1}.getForm().updateRecord(#{GridPanel1}.getSelectionModel().getSelected());#{GridPanel1}.save();#{CadastroProduto}.hide()" />                                        
                                    <ext:Button ID="Button4" runat="server" Text="Cancelar">
                                            <Click Handler="#{CadastroProduto}.hide();#{GridPanel1}.cancelRecord()" />                                        
  2. #2

  3. #3
    Hi Daniil,

    Thanks for helping me, but failed.
    When I click the cancel button (popup) the window is closed but the grid remains with the inserted row, and the row disappears only if I refresh the grid, instead of saving

  4. #4

    Yes, .stopEditing() doesn't remove new records. You have to do it manually.

    Refreshing data doesn't save data.

    See the example how to save:
  5. #5
    Thanks Daniil, examples helped me solve

Similar Threads

  1. [CLOSED] Cancel TreePanel editing
    By RCN in forum 2.x Premium Help
    Replies: 7
    Last Post: Jun 26, 2012, 8:19 PM
  2. [CLOSED] Editing cell of gridPanel
    By supera in forum 2.x Premium Help
    Replies: 7
    Last Post: May 23, 2012, 12:47 PM
  3. How to change GridPanel editing row backcolor
    By kakagu in forum 1.x Help
    Replies: 0
    Last Post: May 08, 2012, 7:06 AM
  4. GridPanel Editor :- Stop editing on enter key
    By vivekrane1986 in forum 1.x Help
    Replies: 2
    Last Post: Oct 22, 2010, 9:50 AM
  5. Editing GridPanel attached to a SQLDatasource
    By tnwheeler in forum 1.x Help
    Replies: 2
    Last Post: Aug 30, 2010, 9:58 PM

Posting Permissions