我有以下问题:
我想将自定义选择器添加到Acumatica的EP301000页面网格的InventoryID字段中,但是当我添加一个附加到它的缓存时:
InventoryID选择器正确更改为我的自定义选择器。
但是当您从查找中选择一个项目时,该字段将继续显示其内容 信息为空白,好像没有选择一个项目。
如果通过键入填充字段数据,则会发生相同的情况,并且字段本身将变为空白。
因此,查找显示的是正确的信息,但是当您选择所需的记录时,该字段不会填充。
使用常规选择器也会使该字段空白。
我尝试不使用任何选择器,并且发生了相同的事情-在这种情况下,假定没有选择器,则item显示其整数值而不是CD。
这是我的扩展图:
public class ExpenseClaimEntrySSGExt : PXGraphExtension<ExpenseClaimEntry>
{
#region Cache Attached
#region InventoryID
//Cache attached use:
//Add Custom Selector
[PXUIField(DisplayName = "Expense Item")]
[SSGCustomExpenseItem(typeof(EPExpenseClaimDetails.contractID))]
protected virtual void EPExpenseClaimDetails_InventoryID_CacheAttached(PXCache Sender)
{
}
#endregion
#endregion
#region CustomSelectors
[PXDBInt]
public class SSGCustomExpenseItemAttribute : PXCustomSelectorAttribute
{
private Type _ContractID;
public SSGCustomExpenseItemAttribute(Type contractID)
: base(typeof(InventoryItem.inventoryID))
{
_ContractID = contractID;
this.SubstituteKey = typeof(InventoryItem.inventoryCD);
this.DescriptionField = typeof(InventoryItem.descr);
}
private string GetSelection()
{
var cache = _Graph.Caches[_BqlTable];
return cache.GetValue(cache.Current, _ContractID.Name)?.ToString(); //Gets the field value by the field name without raising any events.
}
protected virtual IEnumerable GetRecords()
{
string contractString = GetSelection();
int contractID = -1;
contractID = Convert.ToInt32(contractString);
if (contractID != -1)
{
Contract contractRow = PXSelect<Contract,
Where<Contract.contractID, Equal<Required<Contract.contractID>>>>
.Select(this._Graph, contractID);
CSAnswers cSAnswersRow = PXSelect<CSAnswers,
Where<CSAnswers.refNoteID, Equal<Required<CSAnswers.refNoteID>>,
And<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>>>>
.Select(this._Graph, contractRow.NoteID, "DIRINDIREC");
if (cSAnswersRow != null && cSAnswersRow.Value.Equals("IND"))
{
foreach (InventoryItem row in PXSelectJoin<InventoryItem,
InnerJoin<INPostClass,
On<InventoryItem.postClassID, Equal<INPostClass.postClassID>>>,
Where<InventoryItem.itemType, Equal<INItemTypes.expenseItem>,
And<INPostClass.postClassID, Equal<Required<INPostClass.postClassID>>>>>.Select(this._Graph, "IND"))
{
yield return row;
}
}
else
{
foreach (InventoryItem row in PXSelectJoin<InventoryItem,
InnerJoin<INPostClass,
On<InventoryItem.postClassID, Equal<INPostClass.postClassID>>>,
Where<InventoryItem.itemType, Equal<INItemTypes.expenseItem>,
And<INPostClass.postClassID, NotEqual<Required<INPostClass.postClassID>>>>>.Select(this._Graph, "IND"))
{
yield return row;
}
}
}
else
{
foreach (InventoryItem row in PXSelect<InventoryItem,
Where<InventoryItem.itemType, Equal<INItemTypes.expenseItem>>>.Select(this._Graph))
{
yield return row;
}
}
}
}
#endregion
}
答案 0 :(得分:0)
问题似乎出在EPExpenseClaimDetails.InventoryID字段的UI控件类型上。
在网格RowTemplate ASPX元素中,将InventoryID声明为SegmentMask控件,而不是Selector控件:
<px:PXSegmentMask CommitChanges="True" ID="edInventoryID" runat="server" DataField="InventoryID" AllowEdit="True" Size="XM" />
您应使用PXSelector控件替换网格RowTemplate中的PXSegmentMask控件。
只需删除它即可保留该值,但您应使用Selector替换SegmentMask,以便分配CommitChanges / AllowEdit / Size属性。