Query engine boundary
experimental
Sort, filter, grouping and paging as one serialisable descriptor, shown beside the grid.
Live example
Expected behavior
Header and filter interactions update the JSON. Applying edited JSON updates the grid. Server mode shows the same descriptor as the request payload.
Source
const api = createGrid({ rows, columns });
api.setQuery({ version: 1, sort: [{ columnId: 'price', direction: 'asc' }] });
api.patchQuery({ filter: { columnId: 'name', text: 'pen' } });
const url = '?q=' + encodeURIComponent(JSON.stringify(api.getQuery()));
const page = new QueryEngine(getValue).evaluate(rows, api.getQuery());const api = createGrid({ rows, columns });
api.setQuery({ version: 1, sort: [{ columnId: 'price', direction: 'asc' }] });
api.patchQuery({ filter: { columnId: 'name', text: 'pen' } });
const url = '?q=' + encodeURIComponent(JSON.stringify(api.getQuery()));
const page = new QueryEngine(getValue).evaluate(rows, api.getQuery());const api = createGrid({ rows, columns });
api.setQuery({ version: 1, sort: [{ columnId: 'price', direction: 'asc' }] });
api.patchQuery({ filter: { columnId: 'name', text: 'pen' } });
const url = '?q=' + encodeURIComponent(JSON.stringify(api.getQuery()));
const page = new QueryEngine(getValue).evaluate(rows, api.getQuery());const api = createGrid({ rows, columns });
api.setQuery({ version: 1, sort: [{ columnId: 'price', direction: 'asc' }] });
api.patchQuery({ filter: { columnId: 'name', text: 'pen' } });
const url = '?q=' + encodeURIComponent(JSON.stringify(api.getQuery()));
const page = new QueryEngine(getValue).evaluate(rows, api.getQuery());// JavaScript interop module
const api = createGrid({ rows, columns });
api.setQuery({ version: 1, sort: [{ columnId: 'price', direction: 'asc' }] });
api.patchQuery({ filter: { columnId: 'name', text: 'pen' } });
const url = '?q=' + encodeURIComponent(JSON.stringify(api.getQuery()));
const page = new QueryEngine(getValue).evaluate(rows, api.getQuery());API reference
| Kind | Name | Type | Description |
|---|---|---|---|
| Method | getQuery | — | Returns the current QueryDescriptor as plain data. |
| Method | setQuery | — | Validates a descriptor against the columns and applies it in one commit. |
| Method | patchQuery | — | Shallow merge. Present keys replace, null clears. |
| Event | query:changed | — | The descriptor changed. |
| Class | QueryEngine | — | Evaluates a descriptor client-side or on a server with identical row order. |