acumatica选择器中的默认搜索是包含的,它在自定义页面中一次在选择器中输入数据时,会创建许多关闭问题。是否有一种方法来改变行为开始,而不是包含。
更新
我尝试了下面的代码,它是基于开始而不是显示选择器中的所有列进行过滤的
#region Custom Selector Attribute
public class LotSerialNbrSelectionAttribute : PXCustomSelectorAttribute
{
public LotSerialNbrSelectionAttribute(Type type, Type[] fieldlist)
: base(type,fieldlist)
{
}
protected virtual IEnumerable GetRecords()
{
PXView view = new PXView(this._Graph, !this._DirtyRead, this._Select);
PXCache lotSerCach = this._Graph.Caches[typeof(InfoLotSerialFilter)];
List<object> result = new List<object>();
Int32 totalrow = 0;
Int32 startrow = PXView.StartRow;
result = view.Select(PXView.Currents, PXView.Parameters,
PXView.Searches, PXView.SortColumns, PXView.Descendings,
PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);
PXView.StartRow = 0;
string searchval = string.Empty;
if(PXView.Filters.Length > 0)
searchval = PXView.Filters[0].Value.ToString();
InfoLotSerialFilter searchrow = lotSerCach.Current as InfoLotSerialFilter;
foreach(PXResult<INLotSerialStatus> line in result)
{
INLotSerialStatus row = line;
if(string.IsNullOrEmpty(searchval))
yield return row;
else
{
if(row.LotSerialNbr.StartsWith(searchval))
yield return row;
}
}
}
}
#endregion调用属性
#region LotSerialNbr
public abstract class lotSerialNbr : IBqlField
{
}
protected string _LotSerialNbr;
[PXString(100, IsUnicode = true )]
[PXUIField(DisplayName = "Serial Number" )]
[LotSerialNbrSelectionAttribute(typeof(Search2<INLotSerialStatus.lotSerialNbr,InnerJoin<INSite,On<INSite.siteID,Equal<INLotSerialStatus.siteID>>,CrossJoin<MemoSetUp>>,Where<INLotSerialStatus.qtyHardAvail,Greater<decimal0>,And<INLotSerialStatus.siteID,NotEqual<MemoSetUp.memoOutSiteId>>>>),
new Type[]{typeof(INLotSerialStatus.inventoryID),
typeof(INLotSerialStatus.lotSerialNbr),
typeof(INSite.siteCD) }
)]
public virtual string LotSerialNbr
{
get
{
return this._LotSerialNbr;
}
set
{
this._LotSerialNbr = value;
}
}
#endregion结果

InventoryID & SiteID不在选择浏览器中显示
发布于 2020-01-14 19:41:44
我已经尝试了下面给出的修改代码,并且运行良好。
#region Custom Selector Attribute
public class LotSerialNbrSelectionAttribute : PXCustomSelectorAttribute
{
public LotSerialNbrSelectionAttribute(Type type, Type[] fieldlist)
: base(type, typeof(INLotSerialStatus.inventoryID), typeof(INLotSerialStatus.lotSerialNbr), typeof(INSite.siteCD))
{
}
protected virtual IEnumerable GetRecords()
{
PXView view = new PXView(this._Graph, !this._DirtyRead, this._Select);
string searchval = string.Empty;
if (PXView.Filters.Length > 0)
searchval = PXView.Filters[0].Value.ToString();
PXView.Filters.Clear();
//PXCache lotSerCach = this._Graph.Caches[typeof(InfoLotSerialFilter)];
List<object> result = new List<object>();
Int32 totalrow = 0;
Int32 startrow = PXView.StartRow;
result = view.Select(PXView.Currents, PXView.Parameters,
PXView.Searches, PXView.SortColumns, PXView.Descendings,
PXView.Filters, ref startrow, 10000, ref totalrow);
PXView.StartRow = 0;
foreach(PXResult<INLotSerialStatus,INSite> line in result)
{
INLotSerialStatus row = line;
if(string.IsNullOrEmpty(searchval))
yield return line;
else
{
if(row.LotSerialNbr.StartsWith(searchval))
yield return line;
}
}
}
}
#endregion

https://stackoverflow.com/questions/59733805
复制相似问题