Hi All,
Is there a way to find all check boxes that have been check.
Thanks
Hi All,
Is there a way to find all check boxes that have been check.
Thanks
Hi @B4ld3 are you cool to post a snippet of the code you have for the checkboxes you want ticked? I mean a real basic example is on the www.poshud.com website. I used this same example with the custom component I just built, to show if the checkbox was ticked or not.
Hi @psDevUK,
So i need to find out which check have been check.
if ($null -ne $Cache:Header) {
Get-NessusScan -SessionId 0 | ForEach-Object {
[PSCustomObject]@{
Name = $_.Name
ScanId = $_.ScanId
Status = $_.Status
FolderId = $_.FolderId
Owner = $_.Owner
CreationDate = $_.CreationDate
LastModified = $_.LastModified
Check = New-UDCheckbox -Id $_.ScanId
}
} | Out-UDGridData
}
You could do something like this:
When checked, the onchange event handler of the checkbox fires, adding or removing info about the row to an array.
If you take a look at my post history, you should find a post regarding UDSelect, in which I figure out how to pass information about the current row, into the event handler.
More Specifically, this:
-OnChange (
New-UDEndpoint -Endpoint {
Show-UDToast -Message "$($_.ADUSername), $EventData"
} -ArgumentList $($_)
)
Lets say you have an arraylist
$Checked = New-Object System.Collections.ArrayList
Now the most sane way of adding/removing values, would be to check the value of the Checkbox - I don’t know how to do that, but since you already have an ID on the checkbox, it should be obtainable through Get-UDelement.
Alternatively, you could check to see if the value already exists in the Array, but that won’t be pretty.
I hope thats enough to get ya going.
New-UDCheckbox -Id $_.ScanId -OnChange (
New-UDEndpoint -Endpoint {
Show-UDToast -Message "$($_.ScanId) was Checked/Unchecked"
} -ArgumentList $($_)
)
I have tried this but i get error message ‘Cannot bind argument to parameter ‘Message’ because it is an empty string.’
Check = New-UDCheckbox -Id $_.ScanId -OnChange (
New-UDEndpoint -Endpoint {
$Checked = Get-UDElement -Id "$($_.ScanId)"
Show-UDToast -Message $Checked
} -A
name the ID without a sign like just give it a name like -Id "Boxone" think the is confusing it as its not seeing anything being passed in on the id you are supplying
Just to throw my 2 cents in here to keep people from going in circles, but there was about about this being a bug that is being fixed in 2.6.1.
@eefisherv - I was using the nightly build.
i think the issue is due to its in a grid. I enable logging and i can see the results in udlogging.
Not sure if it the best way of doing it but it works.
New-UdGrid -Title "Scans" -Headers @("Name","ScanId","Status","FolderId","Owner","CreationDate","LastModified","Check") -Properties @("Name","ScanId","Status","FolderId","Owner","CreationDate","LastModified","Check") -Endpoint {
#Get Scan List
if ($null -ne $Cache:Header) {
$Cache:NessusCheckBoxElementArray = @{}
Get-NessusScan -SessionId 0 | ForEach-Object {
#Wait-Debugger
[PSCustomObject]@{
Name = $_.Name
ScanId = $_.ScanId
Status = $_.Status
FolderId = $_.FolderId
Owner = $_.Owner
CreationDate = $_.CreationDate
LastModified = $_.LastModified
Check = New-UDCheckbox -Id $_.ScanId -OnChange (
New-UDEndpoint -Endpoint {
$CheckBoxElement = Get-UDElement -Id $_.ScanID
$Cache:NessusCheckBoxElementArray.$($_.ScanID) = $CheckBoxElement.Attributes["checked"]
}
)
}
} | Out-UDGridData