Aug 12, 2011, 4:42 PM
2 different command columns in gridpanel
Hello. I've been trying to put two different command columns in a gridpanel. The two buttons should call a different method, but they will call BOTH methods. Here's the code:
They are DirectEvents.
Help please? :)
Thanks in advance.
<ext:CommandColumn Width="75" Locked="true">
<Commands>
<ext:GridCommand Icon="Add" CommandName="ProdIn" Text="In"></ext:GridCommand>
</Commands>
</ext:CommandColumn>
<ext:CommandColumn Width="75" Locked="true">
<Commands>
<ext:GridCommand Icon="Delete" CommandName="ProdOut" Text="Out"></ext:GridCommand>
</Commands>
</ext:CommandColumn>
<Command OnEvent="ProdIn" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{GridPanel1}.body}" />
<ExtraParams>
<ext:Parameter Name="idProd" Value="record.data.idProd" Mode="Raw"></ext:Parameter>
<ext:Parameter Name="quantity" Value="record.data.quantity" Mode="Raw"></ext:Parameter>
</ExtraParams>
</Command>
<Command OnEvent="ProdOut" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{GridPanel1}.body}" />
<ExtraParams>
<ext:Parameter Name="idProd" Value="record.data.idProd" Mode="Raw"></ext:Parameter>
<ext:Parameter Name="quantity" Value="record.data.quantity" Mode="Raw"></ext:Parameter>
</ExtraParams>
</Command>
Methods (top of page): protected void ProdIn(object sender, DirectEventArgs e)
{
string id = e.ExtraParams["idProd"];
string existencia = e.ExtraParams["quantity"];
this.popupIn.ShowIn(idProd, quantity);
}
protected void ProdOut(object sender, DirectEventArgs e)
{
string id = e.ExtraParams["idProd"];
string existencia = e.ExtraParams["quantity"];
this.popupOut.ShowOut(idProd, quantity);
}
This works fine with one command column, but calls the two methods when any of the two buttons are clicked.They are DirectEvents.
Help please? :)
Thanks in advance.