English 中文(简体)
过滤带有自定义列值的 Acumatica 网格
原标题:Filtering Acumatica Grid with Custom Column Values
  • 时间:2024-07-23 16:36:35
  •  标签:
  • acumatica
I added a new column to the grid in the "Prepare Replenishment" screen (IN50800) please refer the image below: Please note that I have marked the column header which is added as a custom column. Please refer the code below: namespace PX.Objects.IN.S { public class INItemSiteExt : PXCacheExtension { public class ProgNameAttributeID : BqlString.Constant { public ProgNameAttributeID() : base("PROGNAME") { } } #region UsrProgramName [PXString(255, IsUnicode = true)] [PXUIField(DisplayName = "Program Name")] public virtual string UsrProgramName { get; set; } public abstract class usrProgramName : BqlString.Field { } #endregion } } Graph extension: namespace PX.Objects.IN { public class INReplenishmentCreate_Extension : PXGraphExtension { #region Event Handlers protected void INReplenishmentItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { INReplenishmentItem row = e.Row as INReplenishmentItem; if (row == null) return; var item = (InventoryItem)PXSelectorAttribute.Select(cache, row); if (item != null) { var attribute = (CSAnswers)PXSelect>, And>>>> .Select(Base, item.NoteID, "PROGNAME"); if (attribute != null) { cache.SetValueExt(row, attribute.Value.Trim()); } } } #endregion } } With above code it populates the values to the new added column but if I want to filter by it. Like below: It doesn t filter most of the values, but sometimes it searches the first row of the grid. Otherwise it shows nothing. Can anyone find any issues here or missing thing?
问题回答
It is never a good idea to populate field values in RowSelected event, it is always better do it in RowSelecting or FieldDefaulting events; or using PXDefault or PXUnboundDefault attributes. Since your field is unbound, only RowSelecting and PXUnboundDefault would work. Please see this code below, this is everything you need to solve this problem, you don’t need any graph extension. public class INItemSiteExt : PXCacheExtension { #region UsrProgramName [PXString(255, IsUnicode = true)] [PXUnboundDefault(typeof(SelectFrom .InnerJoin.On> .Where .And>> .SearchFor))] [PXUIField(DisplayName = "Program Name")] public virtual string UsrProgramName { get; set; } public abstract class usrProgramName : BqlString.Field { } #endregion } public class ProgNameAttributeID : BqlString.Constant { public ProgNameAttributeID() : base("PROGNAME") { } }




相关问题
过滤带有自定义列值的 Acumatica 网格

我在“准备补充”屏幕(IN50800)的网格中增加了一个新的栏目,请参见以下图像:请注意,我已经标记了作为惯例添加的列页头.。

Access joined table on field udpated event

Is it possible to access the joined table in a field updated event without having to add a loop so that you can access the PXResult<> object? For instance, a graph that looks like this: public ...

热门标签