Dashboard extension API cannot set a default filter on a native list page #5056
kingpeti
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The gap
DashboardDataTableExtensionDefinition(3.7.1) lets an extension change which columns a native list page shows, but not which rows it opens on.viewOptionDefaultsis typed and documented as visibility and order only:The definition has six members (
pageId,blockId,bulkActions,extendListDocument,displayComponents,viewOptionDefaults), and a search offramework/extension-api/turns up no filter-related API at all. Filter state lives intableSettings.columnFilters, owned byListPage, and no extension API writes it.Use case
Our catalogue holds two kinds of
Product, distinguished by aproduct-typefacet: individual meals, and bundles composed of them. Operators work with meals essentially all of the time. We would like/productsto open filtered toproduct-type: meal, while leaving it an ordinary, dismissible filter the operator can clear.We would rather not own the route. Everything else the page does (search, paging, bulk actions, the detail link, custom-field columns) is exactly what we want, and reimplementing it as a custom page to change one default is a lot of surface to keep in step with upstream for one line of intent.
Possible shape
Either a
columnFiltersmember alongside the two that exist:or a separate
defaultFiltermember on the data-table extension. Either way the properties that matter are that it seeds the operator's initial state rather than constraining the query, and that the operator can clear it.Alternatives considered
tableSettings.columnFiltersfrom an extension. Writes into another component's user-preference store, and would fight the operator's own filter on every load rather than seeding it once.transformVariableson the list query. Not reachable without owning the route, and it would make the filter mandatory rather than a default./products?filters=…. Moves the requirement onto whoever types the URL, and does nothing for an operator who clicks the nav item.Environment
@vendure/dashboard3.7.1, Vendure 3.7.1.Happy to open a PR if a maintainer indicates which of the two shapes fits the extension API's direction.
All reactions