Refresh UDGrid with UDSelect

Hello,

I have a problem with my Dashboard.
My Dashboard use a UDSelect Field and a UDGrid.

Bild

i have created two UDSelectOptions (Person 1 and Person 2).
As soon as I select person 1, the OnChange event should start. There a database query is carried out and the skills of person 1 should then be displayed in the DataGrid.
As soon as I select person 2 the DataGrid should be loaded with the new data.

Unfortunately, the DataGrid is not updated.

Do you have any idea what I have to do to update the data?
(Sorry for my bad english)

Here is my current code.

Dashboard

$Footer = New-UDFooter
$Dashboard = New-UDDashboard -Title “Dashboard” -Footer $Footer -NavBarColor “DarkRed” -Content {
New-UDLayout -Columns 1 -Content {
New-UDSelect -Id “mitarbeiter” -Label “Mitarbeiter” -Option {
New-UDSelectOption -Name “Person 1” -Value 1 -Selected
New-UDSelectOption -Name “Person 2” -Value 2
} -OnChange {

		$check = ([string]$eventdata).Trim('"')
		$query = "SELECT Skills.Skill, Mitarbeiter.Nachname, SkillStatus.status
						FROM SkillStatus
						INNER JOIN Skills ON SkillStatus.Skill_ID = Skills.Skill_ID
						INNER JOIN Mitarbeiter ON SKillStatus.Mitarbeiter_ID = Mitarbeiter.Mitarbeiter_ID
						WHERE SkillStatus.Mitarbeiter_ID = $check"
		
		$db.SQLConnection.Open()
		$db.SQLCommand = $db.SQLConnection.CreateCommand()
		$db.SQLCommand.CommandText = $query
		$resultat = $db.SQLCommand.ExecuteReader()
		$Tabelle = new-object System.Data.DataTable
		$Tabelle.Load($resultat)
		$db.SQLConnection.Close()
	}
	
	New-UDGrid -Id "skilltable" -Title "Skills" -Headers @("Skill", "Nachname", "Status") -Properties @("Skill", "Nachname", "Status") -AutoRefresh -RefreshInterval 2 -Endpoint {
		$Tabelle | ForEach-Object {
			[PSCustomObject]@{
				Skill = $_.Skill
				Nachname = $_.Nachname
				Status = $_.status
				
			}
		} | Out-UDGridData
	}
	
}

}

Start-UDDashboard -Dashboard $Dashboard -Port 10001

Thanks a lot.
Best regards
Jens

I have fix this :slight_smile:

Hi Stoni,
I am facing a very similar issue to what you initially reported, New-UDGrid not displaying after a OnChange action, any chance you could give an update as to the issue you found and the fix plese?
Thanks