Last active
February 9, 2021 20:54
-
-
Save BrianMRO/21ccb41f5c6e4065944e2199634b470a to your computer and use it in GitHub Desktop.
Dynamic Lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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