在活動/任務屏幕(cr306020)中,有一個「相關實體」字段,其中包含PXSelector查找以及用於打開相關實體屏幕的鉛筆:如何在字段上放置'相關實體'查找
我想知道是否有辦法自定義字段做到這一點。我查看了該領域的源代碼(它是DAC中的EPActivity.Source),但是我沒有看到將這些屬性放在該字段中的任何內容。沒有PXSelector或類似的東西。
在活動/任務屏幕(cr306020)中,有一個「相關實體」字段,其中包含PXSelector查找以及用於打開相關實體屏幕的鉛筆:如何在字段上放置'相關實體'查找
我想知道是否有辦法自定義字段做到這一點。我查看了該領域的源代碼(它是DAC中的EPActivity.Source),但是我沒有看到將這些屬性放在該字段中的任何內容。沒有PXSelector或類似的東西。
以下示例顯示如何在機會(CR304000)屏幕上添加相關實體字段。請注意,本示例中使用的PXRefNoteSelector控件目前不支持Acumatica Customization Manager中的佈局編輯器。我用機會來簡化和縮短例子。不幸的是,現在只能在自定義屏幕上添加相關實體字段。
現在,讓我們向前邁進,樣品:
實現擴展爲CROpportunity DAC申報勢必UsrRefNoteID和非綁定RelatedEntity領域的數據庫。相關實體的NoteID將存儲在UsrRefNoteID,和RelatedEntity將用於顯示相關實體的用戶友好描述:
public class CROpportunityExt : PXCacheExtension<CROpportunity>
{
#region UsrRefNoteID
public abstract class usrRefNoteID : IBqlField { }
protected Guid? _UsrRefNoteID;
[PXDBGuid]
[PXParent(typeof(Select<CRActivityStatistics,
Where<CRActivityStatistics.noteID, Equal<Current<CROpportunityExt.usrRefNoteID>>>>), LeaveChildren = true)]
public Guid? UsrRefNoteID
{
get
{
return _UsrRefNoteID;
}
set
{
_UsrRefNoteID = value;
}
}
#endregion
#region Source
public abstract class relatedEntity : IBqlField { }
[PXString(IsUnicode = true)]
[PXUIField(DisplayName = "Related Entity Description", Enabled = false)]
[PXFormula(typeof(EntityDescription<CROpportunityExt.usrRefNoteID>))]
public string RelatedEntity { get; set; }
#endregion
}
創建擴展爲OpportunityMaint BLC裝飾用PXRefNoteSelectorAttribute其主機會數據圖。該PXRefNoteSelectorAttribute需要編輯(鉛筆)和查找按鈕上的自定義相關的實體領域的工作:
public class OpportunityMaintExt : PXGraphExtension<OpportunityMaint>
{
[PXCopyPasteHiddenFields(typeof(CROpportunity.resolution))]
[PXViewName(Messages.Opportunity)]
[PXRefNoteSelector(typeof(CROpportunity), typeof(CROpportunityExt.usrRefNoteID))]
public PXSelect<CROpportunity> Opportunity;
}
在ASPX頁面,添加PXRefNoteSelector控制與數據字段屬性設置爲RelatedEntity和NoteIDDataField到UsrRefNoteID。 對於EditButton,LookupButton和LookupPanel標籤,使用主數據查看名稱飾以PXRefNoteSelector屬性(機會在下面的代碼段)
<pxa:PXRefNoteSelector ID="edRefEntity" runat="server" DataField="RelatedEntity" NoteIDDataField="UsrRefNoteID"
MaxValue="0" MinValue="0" ValueType="Guid" CommitChanges="true">
<EditButton CommandName="Opportunity$Navigate_ByRefNote" CommandSourceID="ds" />
<LookupButton CommandName="Opportunity$Select_RefNote" CommandSourceID="ds" />
<LookupPanel DataMember="Opportunity$RefNoteView" DataSourceID="ds" TypeDataField="Type" IDDataField="NoteID" />
</pxa:PXRefNoteSelector>
隱藏通過產生3點的動作表單工具欄中的PXRefNoteSelector屬性。用飾有PXRefNoteSelector屬性(機會在下面的代碼片段)相同的主數據視圖的名字在上面步驟:
<CallbackCommands>
...
<px:PXDSCallbackCommand Name="Opportunity$Navigate_ByRefNote" Visible="False" />
<px:PXDSCallbackCommand Name="Opportunity$Select_RefNote" Visible="False" />
<px:PXDSCallbackCommand Name="Opportunity$Attach_RefNote" Visible="False" />
</CallbackCommands>
您可能還需要實現自己的EntityDescription運營商,因爲當時這個例子中被創建,它有內部訪問修飾符,並沒有可用的PX.Objects.dll之外:
public class EntityDescription<RefNoteID> : BqlFormulaEvaluator<RefNoteID>, IBqlOperand
where RefNoteID : IBqlField
{
public override object Evaluate(PXCache cache, object item, Dictionary<Type, object> pars)
{
Guid? refNoteID = (Guid?)pars[typeof(RefNoteID)];
return new EntityHelper(cache.Graph).GetEntityDescription(refNoteID, item.GetType());
}
}
最後...定製機會截圖屏採用了全新的相關實體領域:
非常感謝,魯斯蘭 - 我會給它儘快嘗試。 – pmfith
您是否在尋找簡單的添加鉛筆圖標(形式)/超鏈接(網格列)到一個字段,當點擊將您帶到另一個頁面?看看這篇文章給你你需要什麼:http://stackoverflow.com/questions/26387291/how-to-create-a-hyperlink-user-field/34190669#34190669 – Brendan