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:
Code:
<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:
Code:
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"))
{
}
}
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