optionValue support for p-treeSelect #2420
Unanswered
puschie286
asked this question in
PrimeNG
Replies: 1 comment
-
helper function: export function getNodeFromKey( key?: string, nodes?: TreeNode[] ): TreeNode | undefined
{
if( key == undefined || nodes == undefined || nodes.length === 0 )
{
return undefined;
}
for( const entry of nodes )
{
// hit ?
if( entry.key === key )
{
return entry;
}
// level down
const found = getNodeFromKey( key, entry.children );
if( found != undefined )
{
return found;
}
}
return undefined;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would be nice to have an optionValue property (like in all other select components).
Currently, selection gives you a TreeNode or TreeNode[]. This makes it pretty complicated to be used within an reactive form.
The only solution i see right know is to create transform method for each treeSelect (and mark element as standalone with ngModelOptions )
Beta Was this translation helpful? Give feedback.
All reactions