OnRowClick for Tables

3 votes

avatar

This is a request for a new Table feature to support a row click function that allows calling an endpoint (running commands) and is spawned from this item on the support form: UDTable On Row Click - Devolutions Forum

Essentially, it would be nice to support clicking anywhere in a table row to then perform some function, whether it be navigate to a new page based off data in the row, popping up a modal, or other options. This would help generate more interactive/dynamic pages and make things cleaner than the current options (configuring a clickable button per row).

The example I provided is as follows, which would pop up a modal displaying additional details on the row clicked:

 New-UDTable -LoadData {
  $Data } -Columns @(
    New-UDTableColumn -IncludeInExport -Id Id -Property Id -Title "Id" -Width 50
    New-UDTableColumn -IncludeInExport -Id ServerName -Property ServerName -Title "Server Name" -Width 150  
    New-UDTableColumn -IncludeInExport -Id CPUS -Property CPUS -Title "CPUs" 
    New-UDTableColumn -IncludeInExport -Id Memory_GB -Property Memory_GB -Title "Memory (GB)" 
    New-UDTableColumn -IncludeInExport -Id OperatingSystem -Property OperatingSystem -Title "Operating System" -Width 100
) -OnRowClick {
 Show-UDModal -FullWidth -Content {
    New-UDCard -Content {
        New-UDGridLayout -Content {
            $VMData = Invoke-PSUEndpoint -Integrated -Url "/api/v1/VM/$($EventData.Id)" | ConvertFrom-Json
            New-UDTextbox -Id 'Id' -Label 'Id' -Value $EventData.Id -Disabled
            New-UDTextbox -Id 'ComputerName' -Label 'ComputerName' -Value $EventData.ServerName -Disabled
            New-UDTextbox -Id 'Department' -Label 'Department' -Value $VMData.Department -Disabled
            New-UDTextbox -Id 'Owner' -Label 'Owner' -Value $VMData.Owner -Disabled
            New-UDTextbox -Id 'State' -Label 'State' -Value $VMData.State -Disabled
        }
      }
    }
  }

All Comments (2)

avatar

HI @SunnyJ , thanks for the feature request! I opened an issue in our backlog for this and will let you know when it's completed.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar
HI @SunnyJ , thanks for the feature request! I opened an issue in our backlog for this and will let you know when it's completed.


@Adam Driscoll in the mean time, would it be possible to work around this by using -ShowSelection -DisableMultiSelect -OnRowSelection, but triggering the row selection when someone clicks anywhere on the row? Via CSS or JS applying to a custom class for the table?