New-UDTableColumn -ShowFilter: is there a way to prefill the filter with a value

Hi

I’m wondering whether it’s possible to ‘pre-fill’ a filter on a column in a UDTable?
In my case there are 2 (3) options: yes, no and all/both. The user will mostly be interested in datarows where the option equals to ‘no’. So I’d like to filter the table on this value before showing it to the user. But the user still needs to make another choise (both or yes).

Thanks for any suggestions.

I would check here if you haven’t for some additional info on the New-UDTableColumn command, though it doesn’t seem to have something that can solve your issue natively.

Are you using server side processing (the -LoadData parameter instead of -Data)? That would help to determine the best way to concoct something for your use case

I ran into the same issue and could not find a way to prefill the data, only by hardcoding the filter but that isn’t a good solution.

You could try to sort the data before building the table so they show up on top like:

$Data = $MyInputdata | Where-Object { $_.MyProperty -eq "bad" }
$Data += $MyInputdata | Where-Object { $_.MyProperty -ne "bad" }

New-UDTable -Data $Data

Not the best solution but it works in my case.