New-UDTableColumn -Render New-UDSelect issue

@jamir88 I’m unsure if it’s possible to ascertain from which row a UDSelect is invoked. As of now, I haven’t stumbled upon a method to achieve this. That said, the -OnRowSelection feature might help. Additionally, while the sample code can shed some light, a visual representation—maybe in the form of a spreadsheet—showcasing your desired result before and after might be helpful. I used -LoadData, but feel free to stick to your approach. Since I frequently work with databases, I based my examples on them, using them as a template.


$Page:Data = foreach ($Item in (0..2)) {
    $Item = $Item.ToString()
    @{
        Col1 = $Item
        Col2 = $Item
        Col3 = $Item
    }
}
New-UDTable -Id 'Table' -LoadData {
    $TableData = ConvertFrom-Json $Body
    $Page:Data | Out-UDTableData -Page $TableData.page -TotalCount $Count.count -Properties $TableData.properties
} -Columns @(
    New-UDTableColumn -Property 'Col1' -Title 'Col1'
    New-UDTableColumn -Property 'Col2' -Title 'Col2'
    New-UDTableColumn -Property 'Col3' -Title 'Col3'
    New-UDTableColumn -Property 'CloneImage' -Title 'CloneImage' -Render {
        Show-UDToast ('$EventData {0}' -f ([PSCustomObject]$EventData | Select-Object *) | Out-String) -Duration 10000
        New-UDSelect -Id "Select_$($EventData.Col1)" -DefaultValue '3' -Option {                                                                               
            foreach ($Item in (3..9)) {  
                $Item = $Item.ToString() 
                New-UDSelectOption -Name $Item -Value $Item
            }                                  
        } -OnChange {
            Show-UDToast ('Was Selected with UDSelect:{0}. Row(s) Selected with checkboxes (Would need to be implemented): {1} ' -f $EventData[0], $Page:SelectedRows) -Duration 10000
            $Page:Data = foreach ($Item in $Page:Data) {
                @{
                    Col1 = $EventData[0]
                    Col2 = $Item.Col2
                    Col3 = $Item.Col3
                }
            }
            Sync-UDElement -id 'Table'
        }
    }
) -ShowSelection -OnRowSelection {
    $Page:Table = Get-UDElement -Id "Table"
    $Page:SelectedRows = $Page:Table.selectedRows
}

This post shows how to retrieve the UDSelect value from each selected row in a UDTable

Hope this helps.