Edit Grid Output

Hello Everyone.

I currently have a grid that with displays users from AD and I wish to be able to edit a user property like cell phone, location, etc.

I have a modal that opens when I click the edit button and I wish to populate the input fields in the Modal with the current user information. My question is - Can you use a variable for the Input place holder or is there another way to edit information in a Grid?

thanks in advance

Wil

I built this component recently:-


which is availble here:- https://marketplace.universaldashboard.io/

To me this is an easier way to pass data to an input field, and to read the data from the input field. Please look at the readme I did for instructions.

1 Like

This looks really nice - I installed the module, but I am not getting an value. Here is a snippet of code:

New-UDGrid -id ‘User’ -Headers @(“UserAccount”, “Name”, “Department”, “Office”, “Edit”) -Properties @(“SamAccountName”, “Name”, “Department”, “Physicaldeliveryofficename”, “Edit”) -Endpoint {

#Get a list of Active Directory Users from Location Resources
$ADUsers = Get-ADUser -Filter * -Properties SamAccountName, Name, Department, Physicaldeliveryofficename -SearchBase “ Something here” 
ForEach($Account in $ADusers) {
$AccountTemp = [PSCustomObject]@{SamAccountName = $Account.SamAccountName; Name = $Account.Name; Department = $Account.Department; Physicaldeliveryofficename = $Account.Physicaldeliveryofficename; Edit = New-UDButton -Text "+" -onclick {
$FieldValue = (Get-UDElement -id 'User').Attributes.value
Show-UDModal -Content {
    New-UDHeading -Text $FieldValue}
}

} 
$GridUsers += $AccountTemp }                           
$GridUsers | Out-UDGridData 

Apologies if this is a simple issue - my skills are still pretty basic.

Wil

so if you using custom module components, you need to enable them in the endpointinitialization which I talk about here:- Animated Number Counter | Powershell Blog

I mean I used this field component recently like:-

New-UDColumn -Size 3 -Endpoint {
New-UDField -Id "Debrief" -Label "Debrief comments" -Value "Type comments here..."
 }

Then get the results:-

New-UDButton -Text "SUBMIT THE FORM" -OnClick {
$Debrief = (Get-UDElement -id 'Debrief').Attributes.value
Show-UDToast -Message "Thank you for $Debrief"
}

Have you tried the readme example of it on the github repo? I know that would involve installing another custom component, but helps with my download stats :slight_smile: plus the ud-selector is super cool

1 Like