Skip to content

Instantly share code, notes, and snippets.

@BrianMRO
Last active Feb 9, 2021
Embed
What would you like to do?
Dynamic Lists
protected void _(Events.RowSelected<XXMyDAC> e)
{
XXMyDAC row = x.Row;
if(*condition*) // Substitute your conditional logic here
{
SelectableValues2 listattr = new SelectableValues2();
PXStringListAttribute.SetList<XXMyDAC.myField>
(e.Cache, row, listattr.AllowedValues, listattr.AllowedLabels);
}
}
public class SelectableValues : PXStringListAttribute
{
public class ListAttribute : PXStringListAttribute
{
public ListAttribute() : base(
new[]
{
Pair(MyValue1, Messages.MyLabel1),
Pair(MyValue2, Messages.MyLabel2),
Pair(MyValue3, Messages.MyLabel3),
})
{ }
}
}
public class SelectableValues1 : PXStringListAttribute
{
public string[] AllowedLabels = new string[]
{
Messages.MyLabel1,
Messages.MyLabel2
};
public string[] AllowedValues = new string[]
{
MyValue1,
MyValue2
};
}
public class SelectableValues2 : PXStringListAttribute
{
public string[] AllowedLabels = new string[]
{
Messages.MyLabel1,
Messages.MyLabel3
};
public string[] AllowedValues = new string[]
{
MyValue1,
MyValue3
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment