Wondering if it’s possible to have a search function like with data table for the end user?
I came up with a hacky way to do this, for a quick prototype…
Threw a textbox at the top, this is the search field to search just one column
New-UDTextbox -Icon (New-UDIcon -Icon Search) -Id 'txtSearchScripts' -Label "Search Script Text (press enter)" -FullWidth -OnEnter {
Sync-UDElement -Id 'dynDataGridScriptArchive'
}
New-UDDynamic -Id 'dynDataGridScriptArchive' -Content {
New-UDDataGrid -LoadRows {
Out-UDSqliteDataGrid -Context $EventData -SqliteInstance "C:\path\path\scriptarchiveDB.db" -Table "ScriptArchiveSample"
} -Columns @(
@{ field = "scriptIdVal"; headerName = "Val"; filterable = $false; width = 80}
@{ field = "scriptName"; headerName = "Name"; filterable = $false; width = 100}
...
...
Then in the function called for the datagrid’s -LoadRows, just tacked on the value from the textbox as part of the query - “scriptText” is the name of the single column that this will search/filter
function Out-UDSQLiteDataGrid {
param(
[Parameter(Mandatory)]
$Context,
[Parameter(Mandatory)]
[string]$Table,
[Parameter(Mandatory)]
[string]$SqliteInstance
)
End {
$SqlFilter = "WHERE "
$SqlFilter += "scriptText LIKE '%$((Get-UDElement -Id 'txtSearchScripts').value)%' AND "
$SqlParameters = @{}
...
...
Quick and dirty