Filtering a single server page
A client filter cannot search rows that were never loaded. Move the whole query to the server in Infinite mode.
Help people narrow a dataset, inspect records, and keep their place.
Build a customer triage view with a searchable Grid and a detail Drawer. Opening a record leaves the query, sort and page intact, so the next customer is one step away.
Use this for a bounded customer list or a server-paged operations queue. A short list with no comparison task can use a simple list; a multi-step record workflow deserves its own detail screen.
Real BluKavantUI components, with a small application controller. Data and save responses are simulated in this page; reload resets the example.
Loading the interactive recipe…
Search, column filters, sorting and paging.
Inspect one customer while the Grid remains mounted.
Create the Grid once. Opening or closing the Drawer only updates its visibility and content; it does not reload or recreate the Grid.
Set RowKeyField to Id. OnRowAction gives the stable key and row; display authorized details for that key. Never use the visible row index as identity.
Search changes which records are shown. If you add bulk actions, name the selected scope and recheck the IDs on the server.
This six-record example uses Client mode. For an unbounded database, use Infinite mode and let the server apply search, filters and sort before count and paging.
| State / contract | Implementation |
|---|---|
| Client mode | Provide the complete bounded Rows array. Search and filters operate on that array. |
| Infinite request | OnDataRequested supplies RequestId, StartRow, EndRow, Sort, Filter and SearchText. EndRow is exclusive. |
| Infinite response | completeDataRequest(requestId, rows, total) returns one range plus the matching filtered total. On error, use failDataRequest(requestId, message). |
| FilterBuilder | Its query tree is a different contract from Grid.Filter. Translate both to your own validated query model; do not pass FilterBuilder JSON directly into the Grid column filter model. |
Call mount(host, authorizedCustomers). The example composes createGrid and createDrawer. Keep the returned instance until the view is actually left; call destroy() on teardown. Pro Grid 1.0.0 has no public serialize/restore-view method, so this recipe preserves view state by retaining the instance.
Install Community and the required Pro add-on for Grid or Kanban recipes, import @blukavantui/community/styles.css and @blukavantui/pro/grid.css, and use a connected host element. The companion CSS styles the surrounding fields, navigation and status messages.
Keep the recipe and shared.ts together; TypeScript resolves the recipe’s ./shared.js import. Add class="recipe-demo" to your host. Supply your records and backend callback as the mount arguments. The downloads use Community 1.0.0 and Pro 1.0.0 imports; the live demo retains its previously verified SDK 0.9.0 runtime.
import { createGrid } from '@blukavantui/pro/grid';
import { createDrawer } from '@blukavantui/community/drawer';
import { node, button, status } from './shared.js';
export interface Customer { Id: string; Name: string; Team: string; Status: string }
// Client mode: rows must be a complete, bounded, authorized result set.
export function mount(host: HTMLElement, rows: Customer[]) {
const toolbar = node('div', '', 'recipe-toolbar');
const label = node('label', 'Search customers');
const search = node('input'); search.type = 'search'; label.append(search);
const gridHost = node('div'), drawerHost = node('div'), detail = node('dl', '', 'recipe-record');
toolbar.append(label); host.append(toolbar, gridHost, drawerHost);
const message = status(host);
const drawer = createDrawer(drawerHost, {
Title: 'Customer details', Content: detail, Placement: 'Right', Size: 'Small',
ShowFooter: false, CloseOnEscape: true, CloseOnBackdrop: true,
});
const grid = createGrid(gridHost, {
RowKeyField: 'Id', Mode: 'Client', Rows: rows,
Columns: [
{ Field: 'Name', Header: 'Customer', MinWidth: 160, Flex: 2 },
{ Field: 'Team', MinWidth: 120, Flex: 1 },
{ Field: 'Status', MinWidth: 120, Flex: 1 },
],
Config: { Height: '340px', EnablePagination: true, PageSize: 5,
ShowFloatingFilters: true, SelectionMode: 'None', IsReadOnly: true,
RowActions: [{ Key: 'inspect', Label: 'Inspect customer', Icon: 'eye' }] },
Events: {
OnRowAction: ({ ActionKey, Row }) => {
if (ActionKey !== 'inspect') return;
detail.replaceChildren();
for (const [key, value] of Object.entries(Row)) {
const line = node('div'); line.append(node('dt', key), node('dd', value)); detail.append(line);
}
drawer.update({ Title: Row.Name, IsOpen: true });
},
OnDataError: ({ Message }) => { message.textContent = Message; },
},
});
search.oninput = () => grid.setSearch(search.value);
toolbar.append(button('Clear search', () => { search.value = ''; grid.setSearch(''); search.focus(); }));
message.textContent = `${rows.length} customers available. Column filters and search combine.`;
// Keep this instance mounted while inspecting; filter, sort and page state stay intact.
return { destroy() { drawer.destroy(); grid.destroy(); host.replaceChildren(); } };
}
Reference BluKavantUi_Pro_Grid → BluGrid and BluKavantUi_Community_Feedback → Drawer. Place them on the same Screen. Grid Basic in Community does not supply this full Grid query/action contract; use Pro for this recipe.
| Binding / handler | Implementation |
|---|---|
| Grid inputs | Columns: BluGridColumn List; RowsJson: serialized customers; RowKeyField: "Id"; Config.RowActions: inspect command. Set Config.ShowFloatingFilters=True and Config.EnablePagination=True. |
| OnRowAction | Map ActionKey, RowId and RowsJson. RowsJson is one row object for this event, despite its plural name. Deserialize it, assign SelectedCustomer, then set DetailsOpen=True. |
| Drawer | Bind IsOpen=DetailsOpen and Title=SelectedCustomer.Name. Put fields in Content. In OnOpenChanged, assign IsOpen back to DetailsOpen. |
| Saved views | For cross-navigation view preferences, configure a unique ViewStorageKey. OnViewChanged emits ViewJson and SearchText. Keep server data authorization independent of browser preferences. |
| Infinite mode alternative | Handle OnDataRequested with your Server Action, then call BluGrid_CompleteDataRequest or BluGrid_FailDataRequest using the original RequestId and the initialized Grid instance ID. |
Add these native Blocks to your consumer Screen, bind the listed events and connect your application actions. The interactive example above runs the web implementation.
Open the full native Grid API →A client filter cannot search rows that were never loaded. Move the whole query to the server in Infinite mode.
This resets useful context. Keep the Grid mounted and use Drawer.IsOpen.
Sorts and filters change positions. Fetch or update by the stable record ID.
Use the linked component accessibility notes when reviewing focus, keyboard behavior and status announcements in your implementation.