GridPanel with Image Commands, mulitple fires

  1. #1

    GridPanel with Image Commands, mulitple fires

    Hi,
    I have a grid panel with 3 image commands.
    For some reason, the code behind fires 3 times.
    If I have 2, it fires 2 times.



    Grid Panel:

    
        <ext:GridPanel ID="GridPanel1" collapsible="true" runat="server" Height="150" trackmouseover="true" storeid="Store1" AutoExpandColumn="Keywords" autowidth="true">
           <LoadMask ShowMask="true" />
            <TopBar>
                <ext:Toolbar runat="server" ID="ctl48">
                    <Items>
                        <ext:Label runat="server" id="ldbl" stylespec="color:white;font-weight:bold;!important" Text="Existing Alerts" />
                        <ext:ToolbarFill ID="ctl49" />
                        <ext:Button runat="server" id="buttonAdd" Text="Add Alert" icon="add">
                            <Listeners>
                                <Click Handler=" if (#{hidEntityId}.getValue()=='-1') Ext.Msg.alert('Goto Entity','You must be at an entity before creating alerts');  else #{WindowAddAlert}.show();" />
                            </Listeners>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <ColumnModel ID="ctl50">
                <Columns>
                    <ext:Column ColumnID="Keywords" Header="Keywords" Sortable="true" DataIndex="Keywords">
                        </PrepareCommand>
                    </ext:Column>
                    <ext:Column ColumnID="NumberOfArticles" Align="center" Header="# Articles" Sortable="true" DataIndex="NumberOfArticles">
                        </PrepareCommand>
                        <Renderer handler="return ZeroArticles(value);" />
                    </ext:Column>
                    <ext:Column ColumnID="CreatedOn" Header="Created On" Align="center" Width="75" Sortable="true" DataIndex="CreatedOn">
                        </PrepareCommand>
                        <Renderer Fn="Ext.util.Format.dateRenderer('m/d/Y')" />
                    </ext:Column>
                    <ext:Column ColumnID="CreatedBy" Header="CreatedBy" Align="center" Width="150" Sortable="true" DataIndex="CreatedBy">
                        </PrepareCommand>
                    </ext:Column>
                    <ext:ImageCommandColumn Width="60" Align="center" header="Cancel" tooltip="Cancel this alert...but keep the articles.">
                        <Commands>
                            <ext:ImageCommand CommandName="Cancel" Icon="Decline">
                                <ToolTip Text="Cancel this alert...but keep the articles." />
                            </ext:ImageCommand>
                        </Commands>
                    </ext:ImageCommandColumn>
                    <ext:ImageCommandColumn Width="60" Align="center" header="Delete" tooltip="Delete this alert, and all associated articles.">
                        </PrepareGroupCommand>
                        </PrepareCommand>
                        <Commands>
                            <ext:ImageCommand CommandName="Delete" Icon="Delete">
                                <ToolTip text="Delete this alert, and all associated articles." />
                            </ext:ImageCommand>
                        </Commands>
                    </ext:ImageCommandColumn>
                    <ext:ImageCommandColumn Width="60" Align="center" header="View" tooltip="View Only Articles.">
                        </PrepareGroupCommand>
                        </PrepareCommand>
                        <Commands>
                            <ext:ImageCommand CommandName="View" Icon="magnifier" >
                                <ToolTip text="Delete this alert, and all associated articles." />
                            </ext:ImageCommand>
                        </Commands>
                    </ext:ImageCommandColumn>
                </Columns>
            </ColumnModel>
            <AjaxEvents>
                <Command onevent="DoCommand"  >
                    <ExtraParams>
                        <ext:Parameter Name="command" value="command" mode="Raw" />
                        <ext:Parameter Name="mediadefinitionid" value="this.getSelectionModel().getSelected().id" mode="Raw" />
                    </ExtraParams>
                </Command>
            </AjaxEvents>
            <SelectionModel>
                <ext:RowSelectionModel ID="ctl232">  
                </ext:RowSelectionModel>
            </SelectionModel>
        </ext:GridPanel>

    Code Behind Method:

     protected void DoCommand(object sender, AjaxEventArgs e)
            {
                List<Articles> articles = null; 
                string command = e.ExtraParams["command"].ToString();
                int id = Convert.ToInt32(e.ExtraParams["mediadefinitionid"].ToString());
    
    
                if (command.Equals("Cancel"))
                {
    
                }
    
                if (command.Equals("Delete"))
                {
    
    
                }
                if (command.Equals("View"))
                { 
                 
                }
    
     
            }
  2. #2

    RE: GridPanel with Image Commands, mulitple fires

    Hi,

    Thanks for pointing out the bug. Fixed and committed to the SVN. The fix will be available in 0.8.2 release

Similar Threads

  1. [CLOSED] GridPanel RowSelect event fires twice
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 17, 2012, 1:30 PM
  2. [CLOSED] [Razor] GridPanel ColumnModel Commands
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2012, 9:39 PM
  3. Replies: 2
    Last Post: Sep 10, 2011, 8:01 AM
  4. Replies: 2
    Last Post: Jul 20, 2010, 3:00 PM
  5. Image commands icons in IE6
    By snagy in forum 1.x Help
    Replies: 0
    Last Post: Mar 03, 2010, 2:08 PM

Posting Permissions