再会
我想向供应商页面上的付款说明网格添加两个新按钮。我需要帮助来显示网格上的新按钮。
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
}
}
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
网格提取
<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>
Run Code Online (Sandbox Code Playgroud)
目前按钮显示在页面顶部而不是网格上?
小智 5
由于没有指定版本,所以我的解决方案是针对 2021 R1 完成的。
要将操作添加到网格中,请执行以下步骤:
此时,您通常可以对 RejectPaymentMethod 重复步骤 4-11,然后发布并查看移动到网格中的操作。对于这种特殊情况,有一个问题。您要添加它们的网格具有不支持操作工具栏的属性的 SkinID。您需要通过以下步骤覆盖此属性:
现在您可以发布并查看所需的操作。注意详细信息将显示标准按钮集,因此您可能需要通过以下步骤删除这些按钮
此时,当您发布操作时,您的操作将显示在网格上(假设您已针对 RejectPaymentMethod 重复步骤 4-11。)