2017-10-13 62 views
0

我有以下用例:如何在Acumatica屏幕中有條件地隱藏PXPanel?

Acumatica下拉菜單,它可以有2個左右的值。

例如:

- 如果用戶選擇選項,我需要顯示PXPanel(ID = 「PANEL1」)

- 如果用戶選擇選項B,I需要顯示PXPanel(ID =「是Panel2 「)

那些PXPanels是裏面一個PXFormView,讓他們有一個數據成員像這樣:

 <px:PXFormView ID="form" runat="server" DataSourceID="ds" DataMember="Waybills"> 

       <px:PXPanel ID="panel1" .. 
       <px:PXPanel ID="panel2" .. 

    </px:PXFormView> 

是否可以有條件地顯示/隱藏PXPanels?

正如RuslanDev所說,我可以用PXLayoutRule(GroupCaption)實現同樣的效果,但在這種情況下,我無法將標題設置爲100%,它等於第一列的寬度。

隨着PXPanel:

enter image description here apsx:

<px:PXPanel ID="panel3" runat="server" Caption="Buyer (Receiver)" RenderStyle="Fieldset" AlreadyLocalized="False" DataMember="" > 

     <px:PXLayoutRule runat="server" StartRow="True" StartColumn="True" ColumnWidth="XM" /> 
     <px:PXSegmentMask CommitChanges="True" ID="edCustomerID" runat="server" DataField="CustomerID" DataSourceID="ds" /> 

     <px:PXLayoutRule runat="server" StartRow="True" StartColumn="True" ColumnWidth="XM" /> 
     <px:PXTextEdit ID="edRecipientTaxRegistrationID" runat="server" DataField="RecipientTaxRegistrationID" Enabled="False" CommitChanges="True" AlreadyLocalized="False" DefaultLocale="" /> 
     <px:PXCheckBox ID="edRecipientIsForeignCitizen" runat="server" DataField="RecipientIsForeignCitizen" AlreadyLocalized="False" Enabled="false"/> 

     <px:PXLayoutRule runat="server" StartColumn="True" ColumnWidth="XM" /> 
     <px:PXTextEdit ID="edRecipientName" runat="server" DataField="RecipientName" Enabled="False" AlreadyLocalized="False" DefaultLocale="" /> 


     <px:PXLayoutRule runat="server" StartColumn="True" ColumnWidth="XM" /> 
     <px:PXTextEdit ID="edRecipientDestinationAddress" runat="server" DataField="RecipientDestinationAddress" CommitChanges="True" AlreadyLocalized="False" DefaultLocale="" /> 

    </px:PXPanel> 

隨着PXLayoutRule:

enter image description here

apsx:

<px:PXLayoutRule runat="server" StartRow="True" StartColumn="True" GroupCaption="Buyer (Receiver)" StartGroup="true" ColumnSpan="3"/> 

       <px:PXLayoutRule runat="server" StartColumn="True" ColumnWidth="XM" /> 

       <px:PXSegmentMask CommitChanges="True" ID="edCustomerID" runat="server" DataField="CustomerID" DataSourceID="ds" /> 

       <px:PXLayoutRule runat="server" StartRow="True" StartColumn="True" ColumnWidth="XM" /> 
       <px:PXTextEdit ID="edRecipientTaxRegistrationID" runat="server" DataField="RecipientTaxRegistrationID" Enabled="False" CommitChanges="True" AlreadyLocalized="False" DefaultLocale="" /> 
       <px:PXCheckBox ID="edRecipientIsForeignCitizen" runat="server" DataField="RecipientIsForeignCitizen" AlreadyLocalized="False" Enabled="false"/> 

       <px:PXLayoutRule runat="server" StartColumn="True" ColumnWidth="XM" /> 
       <px:PXTextEdit ID="edRecipientName" runat="server" DataField="RecipientName" Enabled="False" AlreadyLocalized="False" DefaultLocale="" /> 


       <px:PXLayoutRule runat="server" StartColumn="True" ColumnWidth="XM" /> 
       <px:PXTextEdit ID="edRecipientDestinationAddress" runat="server" DataField="RecipientDestinationAddress" CommitChanges="True" AlreadyLocalized="False" DefaultLocale="" /> 

回答

0

使用,而不是PXPanel PXFormView解決所有的問題。

1

沒有選擇隱藏從業務邏輯整個PXPanel,除了有條件地設定可見用於放置一個PXPanel內的每個輸入控制:

protected virtual void ARFinCharge_RowSelected(PXCache cache, PXRowSelectedEventArgs e) 
{ 
    ARFinCharge fin = e.Row as ARFinCharge; 
    if (fin == null) return; 

    PXUIFieldAttribute.SetVisible<ARFinCharge.fixedAmount>(cache, fin, fin.ChargingMethod == OverdueChargingMethod.FixedAmount); 
    PXUIFieldAttribute.SetVisible<ARFinCharge.lineThreshold>(cache, fin, fin.ChargingMethod == OverdueChargingMethod.PercentWithThreshold); 
    PXUIFieldAttribute.SetVisible<ARFinCharge.minFinChargeAmount>(cache, fin, fin.ChargingMethod == OverdueChargingMethod.PercentWithMinAmount); 
} 

對於PXLayoutRule方法,請使用如下的Aspx佈局(客戶選擇器必須跨越其下方的3列):

<px:PXLayoutRule runat="server" StartRow="True" StartGroup="true" GroupCaption="Buyer (Receiver)" /> 
<px:PXSegmentMask CommitChanges="True" ID="edCustomerID" runat="server" DataField="CustomerID" /> 
<px:PXLayoutRule runat="server" Merge="True" /> 
<px:PXTextEdit ID="edRecipientTaxRegistrationID" Size="M" runat="server" DataField="RecipientTaxRegistrationID" Enabled="False" CommitChanges="True" AlreadyLocalized="False" DefaultLocale="" /> 
<px:PXTextEdit ID="edRecipientName" runat="server" Size="M" DataField="RecipientName" Enabled="False" AlreadyLocalized="False" DefaultLocale="" /> 
<px:PXTextEdit ID="edRecipientDestinationAddress" Size="M" runat="server" DataField="RecipientDestinationAddress" CommitChanges="True" AlreadyLocalized="False" DefaultLocale="" /> 
<px:PXLayoutRule runat="server" Merge="False" /> 
<px:PXCheckBox ID="edRecipientIsForeignCitizen" runat="server" DataField="RecipientIsForeignCitizen" AlreadyLocalized="False" Enabled="false"/> 
<px:PXLayoutRule runat="server" EndGroup="true" /> 

enter image description here

+0

我確實,但面板標題仍然存在。我也想隱藏該標題 – user3857731

+0

您是否嘗試過使用PXLayoutRule而不是PXPanel?我相信與GroupCaption屬性指定的PXLayoutRule應該看起來相同PXPanel – RuslanDev

+0

我做了,它的工作原理,但我面臨其他問題。我不能將PXLayoutRule設置爲100%或者例如colspan 3 ... – user3857731