过滤带有自定义列值的 Acumatica 网格
原标题:Filtering Acumatica Grid with Custom Column Values
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)的网格中增加了一个新的栏目,请参见以下图像:请注意,我已经标记了作为惯例添加的列页头.。
Changing customerid on project does not update current customer and get invalid location error
I have development project where I am syncing data from another system into Acumicatica projects. Sometimes the customer on the project needs to change. But when I set project.CustomerId and call ...
Error in PXSelect for Acumatica 2022 R2 but not 2021 R2 on Custom Table
I have an SQL database shown here:
SELECT [CompanyID]
,[ScreenID]
,[BaseUrl]
,[UrlNumber]
,[DACNameList]
,[ParamList]
,[UrlVariableList]
,[Status]
,[...
How to save custom Workspace Tiles to a Customisation Project Package?
I have a customisation package with custom generic inquiries and reports. These need to be accessible using standard text based menu items on a workspace, and by custom Tiles added to top of the ...
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 ...