在 Acumatica 中向网格添加按钮
Add buttons to Grid in Acumatica
美好的一天
我想在供应商页面的付款说明网格中添加两个新按钮。
我想帮忙在网格上显示新按钮。
C#:
namespace JVDVPayI
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
{
#region Event Handlers
public PXAction<PX.Objects.AP.VendorR> ApprovePaymentMethod;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Approve Payment Method")]
protected void approvePaymentMethod()
{}
public PXAction<PX.Objects.AP.VendorR> RejectPaymentMethod;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Reject Payment Method")]
protected void rejectPaymentMethod()
{}
#endregion
}
}
屏幕:
ASPX:
数据源提取:
<px:PXDataSource ID="ds" runat="server" EnableAttributes="true" Visible="True" Width="100%" TypeName="PX.Objects.AP.VendorMaint" PrimaryView="BAccount">
<CallbackCommands>
<px:PXDSCallbackCommand Name="ApprovePaymentMethod" Visible="False" DependOnGrid="grid" />
<px:PXDSCallbackCommand Name="RejectPaymentMethod" Visible="False" DependOnGrid="grid" />
</CallbackCommands>
网格提取
<px:PXGrid ID="grdPaymentDetails" runat="server" Caption="Payment Instructions" SkinID="Attributes" MatrixMode="True" Height="160px" Width="400px">
<Levels>
<px:PXGridLevel DataMember="PaymentDetails" DataKeyNames="BAccountID,LocationID,PaymentMethodID,DetailID">
<Columns>
<px:PXGridColumn DataField="PaymentMethodDetail__descr" ></px:PXGridColumn>
<px:PXGridColumn DataField="DetailValue" ></px:PXGridColumn>
<px:PXGridColumn DataField="UsrUpdatePaymentInstruction" Width="280" /></Columns>
<Layout FormViewHeight="" ></Layout>
</px:PXGridLevel>
</Levels>
<ActionBar ActionsText="True">
<CustomItems>
<px:PXToolBarButton Text="Approve Payment Method" DependOnGrid="grid" StateColumn="ApprovePaymentMethod">
<AutoCallBack Command="ApprovePaymentMethod" Target="ds"
</AutoCallBack>
</px:PXToolBarButton>
<px:PXToolBarButton Text="Reject Payment Method" DependOnGrid="grid" StateColumn="RejectPaymentMethod">
<AutoCallBack Command="RejectPaymentMethod" Target="ds" >
</AutoCallBack>
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
</px:PXGrid>
目前按钮显示在页面顶部而不是网格上?
由于没有指定版本,我的解决方案是针对2021 R1完成的。
要将您的操作添加到网格,请执行以下步骤:
- 打开您的定制包
- 添加您的屏幕 [AP303000]
- 打开添加的屏幕
- 找到您的操作(数据源 --> 工具栏 --> 特定表单 --> 批准付款方式)
- 设置以下属性:
- DependsOnGrid: grdPaymentDetails(这是您要将其添加到的网格控件的 ID)
- Visible: False(将其隐藏在屏幕顶部)
- 保存
- 找到您要将操作添加到的网格(选项卡 --> 付款 --> 表单 --> [2nd] 列 --> 组 --> 网格:PaymentDetails)
- 向网格添加控件(添加控件 --> 单击按钮并将其拖动到 Grid:PaymentDetails)
- Select 新按钮 ([Grid: PaymentDetails] --> ActionBar-CustomItems --> ToolBarButton
- 设置以下属性
- AutoCallBack --> 命令:ApprovePaymentMethod(这是代码中的操作名称)
- AutoCallBack --> 目标:ds(这是操作的数据源)
- 文本:批准付款方式(这是按钮上显示的文本)
- 保存
此时您通常可以对 RejectPaymentMethod 重复步骤 4-11,然后发布并查看移动到网格中的操作。对于这种特殊情况,有一个陷阱。您要将它们添加到的网格具有不支持操作工具栏的属性 SkinID。您需要通过以下步骤覆盖此 属性:
- Select 目标网格(选项卡 --> 付款 --> 表单 --> [2nd] 列 --> 组 --> 网格:PaymentDetails)
- 更新以下内容属性:
- SkinID:详细信息
- 保存
现在您可以根据需要发布和查看显示的操作。注意详细信息将显示标准按钮集,因此您可能希望通过以下步骤删除这些按钮
- Select 目标网格(选项卡 --> 付款 --> 表单 --> [2nd] 列 --> 组 --> 网格:PaymentDetails)
- 设置以下属性:
- ActionBar --> Actions --> AddNew --> ToolBarVisible: false
- ActionBar --> Actions --> AdjustColumn --> ToolBarVisible: false
- ActionBar --> Actions --> Delete --> ToolBarVisible: false
- ActionBar --> 操作 --> ExportExcel --> ToolBarVisible: false
- ActionBar --> Actions --> Refresh --> ToolBarVisible: false
此时,当您发布操作时,您的操作将出现在网格上(这是假设您已经为 RejectPaymentMethod 重复了步骤 4-11。)
美好的一天
我想在供应商页面的付款说明网格中添加两个新按钮。 我想帮忙在网格上显示新按钮。
C#:
namespace JVDVPayI
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
{
#region Event Handlers
public PXAction<PX.Objects.AP.VendorR> ApprovePaymentMethod;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Approve Payment Method")]
protected void approvePaymentMethod()
{}
public PXAction<PX.Objects.AP.VendorR> RejectPaymentMethod;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Reject Payment Method")]
protected void rejectPaymentMethod()
{}
#endregion
}
}
屏幕:
ASPX:
数据源提取:
<px:PXDataSource ID="ds" runat="server" EnableAttributes="true" Visible="True" Width="100%" TypeName="PX.Objects.AP.VendorMaint" PrimaryView="BAccount">
<CallbackCommands>
<px:PXDSCallbackCommand Name="ApprovePaymentMethod" Visible="False" DependOnGrid="grid" />
<px:PXDSCallbackCommand Name="RejectPaymentMethod" Visible="False" DependOnGrid="grid" />
</CallbackCommands>
网格提取
<px:PXGrid ID="grdPaymentDetails" runat="server" Caption="Payment Instructions" SkinID="Attributes" MatrixMode="True" Height="160px" Width="400px">
<Levels>
<px:PXGridLevel DataMember="PaymentDetails" DataKeyNames="BAccountID,LocationID,PaymentMethodID,DetailID">
<Columns>
<px:PXGridColumn DataField="PaymentMethodDetail__descr" ></px:PXGridColumn>
<px:PXGridColumn DataField="DetailValue" ></px:PXGridColumn>
<px:PXGridColumn DataField="UsrUpdatePaymentInstruction" Width="280" /></Columns>
<Layout FormViewHeight="" ></Layout>
</px:PXGridLevel>
</Levels>
<ActionBar ActionsText="True">
<CustomItems>
<px:PXToolBarButton Text="Approve Payment Method" DependOnGrid="grid" StateColumn="ApprovePaymentMethod">
<AutoCallBack Command="ApprovePaymentMethod" Target="ds"
</AutoCallBack>
</px:PXToolBarButton>
<px:PXToolBarButton Text="Reject Payment Method" DependOnGrid="grid" StateColumn="RejectPaymentMethod">
<AutoCallBack Command="RejectPaymentMethod" Target="ds" >
</AutoCallBack>
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
</px:PXGrid>
目前按钮显示在页面顶部而不是网格上?
由于没有指定版本,我的解决方案是针对2021 R1完成的。
要将您的操作添加到网格,请执行以下步骤:
- 打开您的定制包
- 添加您的屏幕 [AP303000]
- 打开添加的屏幕
- 找到您的操作(数据源 --> 工具栏 --> 特定表单 --> 批准付款方式)
- 设置以下属性:
- DependsOnGrid: grdPaymentDetails(这是您要将其添加到的网格控件的 ID)
- Visible: False(将其隐藏在屏幕顶部)
- 保存
- 找到您要将操作添加到的网格(选项卡 --> 付款 --> 表单 --> [2nd] 列 --> 组 --> 网格:PaymentDetails)
- 向网格添加控件(添加控件 --> 单击按钮并将其拖动到 Grid:PaymentDetails)
- Select 新按钮 ([Grid: PaymentDetails] --> ActionBar-CustomItems --> ToolBarButton
- 设置以下属性
- AutoCallBack --> 命令:ApprovePaymentMethod(这是代码中的操作名称)
- AutoCallBack --> 目标:ds(这是操作的数据源)
- 文本:批准付款方式(这是按钮上显示的文本)
- 保存
此时您通常可以对 RejectPaymentMethod 重复步骤 4-11,然后发布并查看移动到网格中的操作。对于这种特殊情况,有一个陷阱。您要将它们添加到的网格具有不支持操作工具栏的属性 SkinID。您需要通过以下步骤覆盖此 属性:
- Select 目标网格(选项卡 --> 付款 --> 表单 --> [2nd] 列 --> 组 --> 网格:PaymentDetails)
- 更新以下内容属性:
- SkinID:详细信息
- 保存
现在您可以根据需要发布和查看显示的操作。注意详细信息将显示标准按钮集,因此您可能希望通过以下步骤删除这些按钮
- Select 目标网格(选项卡 --> 付款 --> 表单 --> [2nd] 列 --> 组 --> 网格:PaymentDetails)
- 设置以下属性:
- ActionBar --> Actions --> AddNew --> ToolBarVisible: false
- ActionBar --> Actions --> AdjustColumn --> ToolBarVisible: false
- ActionBar --> Actions --> Delete --> ToolBarVisible: false
- ActionBar --> 操作 --> ExportExcel --> ToolBarVisible: false
- ActionBar --> Actions --> Refresh --> ToolBarVisible: false
此时,当您发布操作时,您的操作将出现在网格上(这是假设您已经为 RejectPaymentMethod 重复了步骤 4-11。)