У меня есть следующая проблема:
Я хочу добавить пользовательский селектор в поле InventoryID сетки страниц EP301000 из Acumatica, но когда я добавляю кеш, прикрепленный к нему:
Селектор InventoryID правильно меняется на мой пользовательский селектор.
Но когда вы выбираете элемент из поиска, в поле отображается пустая информация, как будто элемент не выбран.
Если данные поля заполняются путем его ввода, происходит то же самое, и поле само закрывается.
Таким образом, поиск показываетправильная информация, но поле не заполняется при выборе нужной записи.
Использование обычного селектора также закрывает поле.
Я попытался без какого-либо селектора, и происходит то же самое -в этом случае элемент отображает свое целочисленное значение вместо компакт-диска, если отсутствует селектор.
Это мой расширенный график:
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
}