Need information about AjaxEventConfirmation

  1. #1

    Need information about AjaxEventConfirmation

    need delete button with ajaxevent and Ext.Msg.Confirm
    AjaxEventConfirmation was make for this?


  2. #2

    RE: Need information about AjaxEventConfirmation

    Hi,
    See the sample:
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GrdTipoContato.ascx.cs" Inherits="CRMWeb.View.grdTipoContato" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Register Src="~/View/frmTipoContato.ascx" TagName="TipoContato" TagPrefix="UC1" %>
    
    <script type="text/javascript">
        
            var editar = function () {
                return '<img class="imgEditar" ext:qtip="Clique para Editar" style="cursor:pointer;" src="/Img/edit-document_16x16.png" />';
            }
    
            function GridPanel1() { return eval('<%=GridPanel1.ClientID%>'); }
    
    
            function confirmaExclusaoTipoContato(button, e) {
                
                if (GridPanel1().getSelectionModel().hasSelection()) {
                    Ext.Msg.confirm(
                    "Alerta",
                    "Confirma Exclusão ?",
                    retornoAjaxEvent.createDelegate(button, [button, e], true),
                    button
                    );
                    return false;
                }
                else {
                    Ext.Msg.alert("Alerta", "Selecione um registro...");
                }
            }
                
    
            function retornoAjaxEvent(btnId, text, sender, e) {
                if (btnId == 'yes') {
                    sender.ajaxEvents.click.fn.apply(sender, [sender, e]);
                }
            }   
            
    </script>
    
    <ext:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </ext:ScriptManagerProxy>
    <ext:DesktopWindow 
        ID="TipoContato" 
        runat="server" 
        Collapsible="true" 
        IconCls="icon-phone16" 
        Title="Tipos de Contatos" 
        BodyStyle="padding: 6px;" 
        Width="400" 
        Height="360"    
        Maximizable="false">
        <body>
            <ext:Store ID="StoreTipoContato" runat="server" AutoLoad="true" OnRefreshData="RefreshData1" RefreshAfterSaving="Auto" >
    <%--        <Proxy>
                    <ext:DataSourceProxy/>
                </Proxy>
    --%>            
                <Reader>
                    <ext:JsonReader  ReaderID="tctId">
                        <Fields>
                            <ext:RecordField Name="tctId"/>
                            <ext:RecordField Name="tctDescricao"/>                                        
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>                    
            <ext:GridPanel 
                ID="GridPanel1" 
                runat="server" 
                StoreID="StoreTipoContato" 
                StripeRows="true"     
                Border="false"                     
                SelectionMemory="Disabled"                            
                Height="265">
                    <TopBar>
                        <ext:Toolbar ID="Toolbar1" runat="server">
                            <Items>                        
                                <ext:ToolbarButton ID="btnInserir" runat="server" Icon="Add">
                                    <Listeners>
                                        <Click Handler="scriptNovoFrmTipoContato();"  />
                                    </Listeners>
                                    <ToolTips>
                                        <ext:ToolTip Html="Novo Tipo Contato"></ext:ToolTip>
                                    </ToolTips>                                
                                </ext:ToolbarButton>                                
                                <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server">                            
                                </ext:ToolbarSeparator>
                                
                                <ext:ToolbarButton ID="btnEditar" runat="server" Icon="ApplicationEdit" Enabled="false">
                                    <AjaxEvents>                                    
                                        <Click OnEvent="Editar">                                        
                                            <ExtraParams>
                                                <ext:Parameter Name="id" Value="#{GridPanel1}.getSelectionModel().hasSelection() ? #{GridPanel1}.getSelectionModel().getSelected().data.tctId : -1" Mode="Raw" />
                                            </ExtraParams>                                                                               
                                        </Click>
                                    </AjaxEvents>                           
                                    <ToolTips>
                                        <ext:ToolTip Html="Editar Tipo Contato"></ext:ToolTip>
                                    </ToolTips>                                
                                </ext:ToolbarButton>
                                <ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server">                            
                                </ext:ToolbarSeparator>                                                  
                                
                                <ext:ToolbarButton ID="btnExcluir" runat="server" Icon="Cross" Enabled="false">                                
                                    <Listeners>                                
                                        <Click fn="confirmaExclusaoTipoContato" />                             
                                    </Listeners>                                                               
                                    <AjaxEvents>
                                        <Click OnEvent="Excluir" >
                                            <ExtraParams>
                                                <ext:Parameter Name="id" Value="#{GridPanel1}.getSelectionModel().hasSelection() ? #{GridPanel1}.getSelectionModel().getSelected().data.tctId : -1" Mode="Raw" />
                                            </ExtraParams>                                        
                                        </Click>
                                    </AjaxEvents>                           
                                    <ToolTips>
                                        <ext:ToolTip Html="Excluir Tipo Contato"></ext:ToolTip>
                                    </ToolTips>                                
                                </ext:ToolbarButton>                            
                                <ext:ToolbarSeparator ID="ToolbarSeparator3" runat="server">                            
                                </ext:ToolbarSeparator>                                                                              
                                <ext:ToolbarButton ID="btnSair" runat="server" Icon="DoorOut">                                
                                    <Listeners>
                                        <Click Handler="#{TipoContato}.hide(null);" />
                                    </Listeners>
                                    <ToolTips>
                                        <ext:ToolTip Html="Sair"></ext:ToolTip>
                                    </ToolTips>                                
                                </ext:ToolbarButton>                                
                                
                                
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                
                    <ColumnModel ID="ColumnModel1" runat="server">
                        <Columns>                        
                            <ext:Column ColumnID="tctId" Header="Id" Width="25" Sortable="true" DataIndex="tctId"></ext:Column>
                            <ext:Column ColumnID="tctDescricao" Header="Descrição" Width="320" Sortable="true" DataIndex="tctDescricao"></ext:Column>                        
                        </Columns>                                                                
                    </ColumnModel>
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
                            <Listeners>
                                <RowSelect Handler="#{btnEditar}.enable();#{btnExcluir}.enable(); " />                             
                                <RowDeselect Handler="if (!#{GridPanel1}.hasSelection()) {#{btnEditar}.disable();#{btnExcluir}.disable() }" />                
                            </Listeners>                       
                        </ext:RowSelectionModel>
                        
                        
                    </SelectionModel>
                    <LoadMask ShowMask="true" Msg="Atualizando Grid ..."/>
                    <BottomBar>
                        <ext:PagingToolBar ID="PagingToolBar1"                                        
                                           runat="server" 
                                           PageSize="10" 
                                           StoreID="StoreTipoContato" 
                                           PrevText="Página Anterior"                                        
                                           NextText="Próxima Página"
                                           BeforePageText="Página"
                                           AfterPageText="de"
                                           LastText="Última Página"
                                           FirstText="Primeira Página"
                                           DisplayInfo="true"
                                           EmptyMsg="Não há Registros"
                                           RefreshText="Recarregar"
                                           DisplayMsg="Registro {0} - {1} de {2}"/>
                    </BottomBar>
                    <AjaxEvents>                   
                       <RowDblClick OnEvent="Editar">
                            <ExtraParams>
                                <ext:Parameter Name="id" Value="#{GridPanel1}.getSelectionModel().getSelected().data.tctId" Mode="Raw" />                                                                
                            </ExtraParams>                              
                        </RowDblClick>
                    </AjaxEvents>                
                    
            </ext:GridPanel>         
            <UC1:TipoContato ID="uc1" runat="server" />     
        </body>
    </ext:DesktopWindow>

Similar Threads

  1. Get Users Information
    By rsaldanhabr in forum 1.x Help
    Replies: 6
    Last Post: Mar 13, 2013, 5:32 PM
  2. DragDrop item information from TreePanel
    By Dominik in forum 2.x Help
    Replies: 1
    Last Post: Jun 01, 2012, 10:31 AM
  3. Problem With Internet Information Service(IIS).
    By nadiepornadie in forum 1.x Help
    Replies: 2
    Last Post: Jan 18, 2011, 1:01 AM
  4. More Information Required
    By geoffrey.mcgill in forum Open Discussions
    Replies: 0
    Last Post: Sep 23, 2010, 9:08 PM
  5. Replies: 0
    Last Post: Oct 30, 2008, 11:12 PM

Posting Permissions