Product: PowerShell Universal
Version: 1.5.0 (358714472 Thu, 12 Nov 2020 00:35:06 GMT )
Product: Universal Dashboard 3.2.0
Hello,
I’m trying to display a table as following
Host | Category | Patches
host1 | Server | 2
host2 | Applications | 10
host3 | Applications | none
The thing is i put a text filter on host, i’ve put a select filter on category, but what kind of filter do i have to put on patches column ?
i can’t put select as i have around thousand of rows each with different entries on patches column.
i can;t put text as i want to select all the rows that have patches > 0
How can i achieve a filter where i select patches > 0 ?
thanks.
Also, is there a list with all the filter types that i can use ? I know there is select and text (from here https://docs.ironmansoftware.com/dashboard/components/data-display/table#selection ) but are there any other filter types ?
Thank you.
currently, we have range, select, text, slider.
we will add more, we currently checking a datetime filter
thanks for the answer. where can i find some examples or more info about the range and slider filter type ?
thanks.
also, would be cool if check box would be available.
there is a checkbox, you can use this example
$Data = try { get-service -ea Stop | select Name,@{n = "Status";e={ $_.Status.ToString()}},@{n = "StartupType";e={ $_.StartupType.ToString()}},@{n = "StartType";e={ $_.StartType.ToString()}} } catch {}
$Columns = @(
New-UDTableColumn -Property Name -Title "Service Name" -ShowSort -IncludeInExport -IncludeInSearch -ShowFilter -FilterType text
New-UDTableColumn -Property Status -Title Status -ShowSort -DefaultSortColumn -IncludeInExport -IncludeInSearch -ShowFilter -FilterType select
New-UDTableColumn -Property StartupType -Title StartupType -IncludeInExport -ShowFilter -FilterType select
New-UDTableColumn -Property StartType -Title StartType -IncludeInExport -ShowFilter -FilterType select
)
New-UDTable -Id 'service_table' -Data $Data -Columns $Columns -Title 'Services' -ShowSearch -ShowPagination -ShowSelection -Dense -OnRowSelection {
$Item = $EventData
Show-UDToast -Message "$($Item | out-string)"
}
New-UDButton -Text "GET Rows" -OnClick {
$value = Get-UDElement -Id "service_table"
Show-UDToast -Message "$( $value.selectedRows | Out-String )"
}
this will show you how to enable selection
and you don’t need more info for the filterType, because you can’t edit the filter or something like that,
but if one of your columns is displayed numbers just try the range filterType
there is a checkbox, you can use this example
well i’ve tried with -filtertype checkbox and check but it is not working. maybe i didn’t quite explained it right. what i was referring was a checkbox on the filter type where you can have multiple selects.
for instance i want to filter by the category in this list
Host | Category | Patches
host1 | Server | 2
host2 | Applications | 10
host3 | Applications | none
host4 | web | 93
and i want to select two categories (server and web) and display all the rows in that category.
currently if i use select i can select only one category, either server or web.
So you want multi select filter, if so we currently not have this
oh, i understand.
I have another question.
I’m trying to migrate from 2.9 dashboard to latest version. In 2.9 i had a grid that had a button that popped a modal. i can’t seem to manage to make it work on the latest version. am i doing something wrong ? basically i have it as the property of an object and am passing it to the udtable. should i approach this differently to make it work ??
can you share your dashboard? for example
sure.
so this is it
$Pages += New-UDPage -Name 'Shopfloor' -Endpoint {
New-UDGrid -Title "Shopfloor Computers" -Headers @( "Name", "IP", "MAC", "MORE") -Properties ("HOSTNAME", "IP", "MAC", "MORE") -Endpoint {
$cur = Get-Date
get-oracle 'select * from shopfloor' | Select-Object -Skip 1 | ForEach-Object {
$Row = $_
[PSCustomObject]@{
HOSTNAME = $Row.HOSTNAME
IP = if ([DBNull]::Value.Equals($Row.IP)) {
New-UDElement -Tag 'div' -Attributes @{ style = @{ 'font-weight' = 'bold'; 'color' = 'red' } } -Content { "No info" }
}
else {
$Row.IP
}
MAC = if ([DBNull]::Value.Equals($Row.MAC)) {
New-UDElement -Tag 'div' -Attributes @{ style = @{ 'font-weight' = 'bold'; 'color' = 'red' } } -Content { "No info" }
}
else {
$Row.MAC
}
MORE = New-UDButton -Text "+" -OnClick (New-UDEndpoint -Endpoint {
Show-UDModal -Header {
New-UDHeading -Size 3 -Text "Info"
} -Content {
New-UDRow {
New-UDColumn -Size 4 {
New-UDTextbox -Value $ArgumentList[0] -Disabled -Label "Hostname"
New-UDTextbox -Value $ArgumentList[1] -Disabled -Label "IP"
New-UDTextbox -Value $ArgumentList[3] -Disabled -Label "MAC"
}
New-UDColumn -Size 4 {
New-UDTextbox -Value $(if (($ArgumentList[5] -eq '01-01-1970 00:00:00') -or ($ArgumentList[5] -eq $null) -or ($ArgumentList[5] -eq '')) {
"No backup"
}
else {
$ArgumentList[5]
}) -Disabled -Label "Last Backup"
}
}
}
} -ArgumentList $Row.hostname, $Row.ip, $Row.PATCHES, $Row.MAC, $Row.TIME_LAST, $Row.BACKUP_LAST_SUCCESS,)
}
} | Out-UDGridData
}
}
which this worked great. only problem that i had was when i was exporting the grid to csv. the values that were with
New-UDElement -Tag 'div' -Attributes @{ style = @{ 'font-weight' = 'bold'; 'color' = 'red' } } -Content { "No info" }
in csv it was [object object]. the thing is this is not working now in the ud table so i can’t make a columns with buttons. any workarround ?
thanks.