I have a page that renders a SQL dataset returned from a dbatools Invoke-DbaQuery request. It works great, and UDGridData is very nice looking. I was wondering if there’s a way to link each row to a particular row/id value for clicking to open another page which reads the row/id value to display more details for that row? Here’s my example grid page…
Hey @skatterbrainz yeah this is possible and I have this working in a few of my grids I got. First place I saw this mentioned was here:- https://poshtools.com/2019/01/17/universal-dashboard-adding-buttons-to-a-udgrid/
I managed to figure it out from this example provided. I got some I could share if you struggling but not to hand right now. Hopefully that link will enable you to do what you want.
Hey @dtnyc9005 I used to use powershell studio to build apps I needed. In that they have the datagrid where you can highlight a whole row on select. Do you mean that ability? I mean I have a grid in UD that displays a customer total for the week. I have an invoice button that when clicked shows all the items that customer bought in a modal window which adds to the total. This is I believe the only way to select the row
@dtnyc9005
Are you thinking of selecting multiple rows and then use a button at the end to do a function on the selected rows?
I’d probably go with manually adding a checkbox button into the grid in another column.
Doh @BoSen29 why didn’t I think of that…I was thinking checkboxes as well on powershell studio datagrids, just never thought about adding checkboxes to UD grids…DOH! well pointed out! @dtnyc9005 I believe as @BoSen29 has mentioned adding checkboxes not buttons would be the approach to go, then I guess have a submit button at the bottom of the grid which would give you all the row numbers which have been selected to then perform an action on those items…
Hey @skatterbrainz Im not a HTML guy, but if you know what your doing constructing HTML tables then why not use that via the New-UDHTML command, I answered someones question the other day and it worked. UD uses https://griddlegriddle.github.io/Griddle/ for the UD grids that are displayed. Any modificiation to this UD grid element will mean downloading a clone from github off of ironman universal dashboard, then run the build.ps1 file to create the output folder, then modify the ud-grid.jsx file to include this feature, then re-run the build script then import the module from the output folder, and test if your modification worked, then create some pester tests, then do a PR back to the main github ironman…I only know this much as the export to CSV didnt work in IE which I have to use for the users using my dashbaords…it took me a good few attempts to say the least.
Oooh! I think I discovered the better way using UDTableGrid and UDElement from this forum post: Coloring Elements in a Table based on a property - The downside is no “filter” feature, or column sorting. But I’m still learning.
@J-C Thanks for sharing. I’m guessing shared code is likely different from what you really implement. Anyway if someone doesn’t like it they are free to change it as desired. My preference is 2 spaces indentation between blocks of code. In VScode, I set code folding preference to ‘indentation’.
if (condition) {
"this is true"
} else {
"this is false"
}
Now in large code files ‘Ctrl K+0’ will collapse down to a single page in VScode ususally. I know others like to have multiple files per project which make sense for larger projects. Many moons ago when I was doing system programming, it wasn’t unusual to be working with code files with 100,000 lines of code or bigger. This was mainframe stuff. I think is best to develop your own style and stick to it and be acceptable of other styles that don’t match your desires.