PDA

View Full Version : [CLOSED] Migrating GridPanel Command to columns



rmelancon
Jun 28, 2013, 8:34 PM
I can't find an example showing how this is done. Here is the current 1.x code:



<ext:GridPanel ID="CurrentCriteriaGrid" runat="server" Title="Current Criteria" HideHeaders="true" Hidden="true" Border="false" AutoHeight="true" AutoScroll="true" AutoDoLayout="true">
<View>
<ext:GridView ForceFit="true" ScrollOffset="0" />
</View>
<TopBar>
<ext:Toolbar runat="server" Layout="HBoxLayout">
<Items>
<ext:SelectBox ID="GroupTypeSelect" runat="server" AllowBlank="false" Flex="1">
<Items>
<ext:ListItem Text="And (Matches All Criteria)" Value="1" />
<ext:ListItem Text="Or (Matches Any Criteria)" Value="2" />
</Items>
</ext:SelectBox>
</Items>
</ext:Toolbar>
</TopBar>
<Store>
<ext:Store ID="CurrentCriteriaStore" runat="server">
<Model>
<ext:Model runat="server" IDProperty="index">
<Fields>
<ext:ModelField Name="description" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" DataIndex="description" Flex="1" />
<ext:CommandColumn runat="server" Width="50" Fixed="true" Resizable="false">
<Commands>
<ext:GridCommand CommandName="Edit" Icon="Pencil" ToolTip-Text="Edit this search criteria" />
<ext:GridCommand CommandName="Delete" Icon="Delete" ToolTip-Text="Delete this search criteria" />
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Single" />
</SelectionModel>
<DirectEvents>
<Command OnEvent="CurrentCriteria_Command">
<ExtraParams>
<ext:Parameter Name="command" Value="command" Mode="Raw" />
<ext:Parameter Name="index" Value="record.id" Mode="Raw" />
</ExtraParams>
</Command>
</DirectEvents>
</ext:GridPanel>

Baidaly
Jun 29, 2013, 12:40 AM
Hello!

Take a look at this examples:

http://examples2.ext.net/#/GridPanel/Commands/Prepare_Toolbar/
http://examples2.ext.net/#/GridPanel/Commands/Cell_Command/

rmelancon
Jul 01, 2013, 11:49 AM
Hello!

Take a look at this examples:

http://examples2.ext.net/#/GridPanel/Commands/Prepare_Toolbar/
http://examples2.ext.net/#/GridPanel/Commands/Cell_Command/

Ok, so in the case below I have a series of command columns that all call the same proc "grdResults_Command" in the code behind. Do I have to copy the code for the Command Listener to every individual command column?



<ColumnModel ID="ColumnModel6" runat="server" DefaultSortable="false" >
<Columns>
<ext:Column runat="server" ID="GoalID" Text="GoalID" Hidden="true" DataIndex="GoalID">
</ext:Column>
<ext:Column runat="server" ID="GoalDescription" Text="Description" DataIndex="GoalDescription" Flex="1">
</ext:Column>
<ext:Column runat="server" ID="OutlierRelativeCount" Width="45" Text="Outlier Relative" Align="Right" DataIndex="OutlierRelativeCount">
<PrepareCommands Fn="prepareOutlierRelativeCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="OutlierAbsoluteCount" Text="Outlier Absolute" Width="45" DataIndex="OutlierAbsoluteCount" Align="Right" Hidden="false">
<PrepareCommands Fn="prepareOutlierAbsoluteCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="IdentifyReturnCount" Width="45" Text="Identify Return" Align="Right" DataIndex="IdentifyReturnCount">
<PrepareCommands Fn="prepareIdentifyReturnCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="FlowsAbsoluteCount" Width="45" Text="Flows Absolute" Align="Right" DataIndex="FlowsAbsoluteCount">
<PrepareCommands Fn="prepareFlowsAbsoluteCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="FlowsRelativeCount" Width="45" Text="Flows Relative" Align="Right" DataIndex="FlowsRelativeCount">
<PrepareCommands Fn="prepareFlowsRelativeCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="MarketValueMinMaxCount" Width="45" Text="MV Min Max" Align="Right" DataIndex="MarketValueMinMaxCount">
<PrepareCommands Fn="prepareMarketValueMinMaxCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="MidMonthEnrollmentCount" Width="45" Text="Intra Period Enrollment" Align="Right" DataIndex="MidMonthEnrollmentCount">
<PrepareCommands Fn="prepareMidMonthEnrollmentCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="PartialPeriodCount" Width="45" Text="Partial Period" Align="Right" DataIndex="PartialPeriodCount">
<PrepareCommands Fn="preparePartialPeriodCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="PreTradeComplianceCount" Width="45" Text="PreTrade Comp" Align="Right" DataIndex="PreTradeComplianceCount">
<PrepareCommands Fn="preparePreTradeComplianceCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="CarveOutCount" Width="45" Text="Carve Out" Align="Right" DataIndex="CarveOutCount">
<PrepareCommands Fn="prepareCarveOutCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="AccountLockedCount" Width="45" Text="Account Locked" Align="Right" DataIndex="AccountLockedCount">
<PrepareCommands Fn="prepareAccountLockedCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="AccountSourceCount" Width="45" Text="Account Source" Align="Right" DataIndex="AccountSourceCount">
<PrepareCommands Fn="prepareAccountSourceCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
</ext:Column>
<ext:Column runat="server" ID="ProposalAccountStatusCount" Width="45" Text="Proposal Account Status" Align="Right" DataIndex="ProposalAccountStatusCount">
<PrepareCommands Fn="prepareProposalAccountStatusCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
<Listeners>
<Command handler="grdResults_Command">
<CustomConfig>
<ext:ConfigItem>
<ext:Parameter Name="command" Value="command" Mode="Raw" />
<ext:Parameter Name="key" Value="record.data.GoalID" Mode="Raw" />
</ext:ConfigItem>
</CustomConfig>
</Command>
</Listeners>
<Loader runat="server">
<LoadMask ShowMask="true" Msg="Applying Command" />
</Loader>
</ext:Column>
</Columns>
</ColumnModel>





Protected Sub grdResults_Command(ByVal sender As Object, ByVal e As DirectEventArgs)
Dim key = e.ExtraParams("key")
Context.Session("CurrentGoalAuditGoalID") = key
Context.Session("GoalAuditMainCommand") = e.ExtraParams("command")
Select Case e.ExtraParams("command")
Case "OutlierRelative"
Context.Session("GoalAuditHeatMapCommand") = "OutlierRelative"
Ext.Net.X.Js.AddScript(Adhesion.Core.Web.GetPopupS cript("GoalAuditHeatMap.aspx?g=" & Encrypt(key), "GoalAuditOLR", 1200, 800))
Case "OutlierAbsolute"
Context.Session("GoalAuditHeatMapCommand") = "OutlierAbsolute"
Ext.Net.X.Js.AddScript(Adhesion.Core.Web.GetPopupS cript("GoalAuditHeatMap.aspx?g=" & Encrypt(key), "GoalAuditOLA", 1200, 800))
Case "IdentifyReturn", "FlowsAbsolute", "FlowsRelative", "MarketValueMinMax", "MidMonthEnrollment", "PartialPeriod"
Ext.Net.X.Js.AddScript(Adhesion.Core.Web.GetPopupS cript("GoalAuditIdentifyPerformance.aspx", "GoalAudit" & e.ExtraParams("command"), 1200, 800))
Case "PreTradeCompliance", "CarveOut", "AccountLocked", "AccountSource", "ProposalAccountStatus"
...

Daniil
Jul 01, 2013, 3:59 PM
Yes, you are right, you should attach a DirectEvent for each Column.

Baidaly
Jul 01, 2013, 5:03 PM
<ext:Column runat="server" ID="ProposalAccountStatusCount" Width="45" Text="Proposal Account Status" Align="Right" DataIndex="ProposalAccountStatusCount">
<PrepareCommands Fn="prepareProposalAccountStatusCommands" />
<Commands>
<ext:ImageCommand CommandName="Dummy" />
</Commands>
<Listeners>
<Command handler="grdResults_Command">
<CustomConfig>
<ext:ConfigItem>
<ext:Parameter Name="command" Value="command" Mode="Raw" />
<ext:Parameter Name="key" Value="record.data.GoalID" Mode="Raw" />
</ext:ConfigItem>
</CustomConfig>
</Command>
</Listeners>
<Loader runat="server">
<LoadMask ShowMask="true" Msg="Applying Command" />
</Loader>
</ext:Column>

One more thing, as a DirectEventHandler the grdResults_Command function should be called using DirectEvents:



<DirectEvents>
<Command OnEvent="grdResults_Command">
<ExtraParams>
<ext:Parameter Name="nameOfYourParameter" Value="valueOfYourParameter" />
</ExtraParams>
</Command>
</DirectEvents>