I have a single page that contain two UdGrids that both span 6 column widths and sit adjacent to one another. In my first grid I have a dynamic table that refreshes every 600 seconds and contains a button for each record. When a user selects the button, I want a query to fire off to gather the data and then have a line graph in grid #2 be populated with that data. I am slightly confused on what I need to put in the onClick event of the button to manually refresh the graph in grid #2. It’s important to emphasize that I want these visuals (The table and the line graph) to be layed out horizontally and NOT vertically, which means I have 2 separate grid in my grid container.
You’ll probs wanna take a look at this example:
Sync-UDElement and Dynamic regions are what you need.
After posting this thread I actually tried exactly this. However, I am still struggling on how to click a button in a table and get a chart to refresh. In the documentation, New-UDDynamic is initalized with $Data = Get-Service and is refreshed based on a separate button click. This makes perfect sense and is fairly easy to do.
In my specific scenario, I am wanting to click a button and pass the $EventData into my graph, which will then fire a query off and use the EventData as parameters for the query to return the data. On page load I get an error message because it can’t use $EventData, but even after clicking the button in one of my table rows I still see no chart populate.
You could look at using a session variable, sounds like you’re trying to pass event data out of scope to another element.
So basically, when the user clicks the button, set your $session variable with the event data, then use the sync command to update your dynamic region with your chart, that pulls from the same variable.
This is exactly what I was looking for! If I may, since this is still related to my issue, how can I retrieve EventData from a button click? Based on the documentation it seems like this is not possible, but I could’ve sworn I’ve done this before.
To be more specific, If I click a button in one of the rows of my table, I need to grab one of the values from a column in that table and use that value in a separate query that populates my chart. I tried doing $Session:MyVariable = $EventData.MyColumn1, but it looks like no value is being passed.
Okay so it seems like New-UDButtonLoader (3rd party module) does NOT support EventData, but New-UDButton does even though the documentation says otherwise.
“For example, the New-UDButton
-OnClick
event handler does not provide any data.”