Update: skipUrlSync and
skipFetch are now documented among the inputs of
wuic-filter-bar. Fixed in
WUIC Framework 1.8.2 .
The original answer below describes versions before 1.8.2.QuestionI embed
wuic-filter-bar inside a dialog (or a page that already uses its own query string). Every time the user applies a filter, a sort or a page size,
filterInfo,
sortInfo and
pageInfo show up in the URL and collide with my own parameters. How do I turn that off without losing the filtering itself?
AnswerSet
skipUrlSync to
true on the filter bar. It is an input of
wuic-filter-bar, so the filter, sort and page-size controls keep working but nothing is written to the address bar.
<wuic-filter-bar
[hardcodedDatasource]="ds"
[skipUrlSync]="true" />
Why it works: after each apply (basic or advanced filter, clear, sorting, page size) the bar first calls
fetchData() on the data source and then syncs the grid state to the query string, merging
filterInfo,
sortInfo and
pageInfo into the current route's parameters.
skipUrlSync only skips that second step. The current state is still held by the data source (
filterInfo,
sortInfo,
pageSize,
currentPage), and you can read it from the events:
onFilterApplied,
onSortingApplied and
onPageSizeApplied.
Two things to keep in mind:
skipUrlSync does not stop the data fetch. If you also want the bar to only emit its outputs without calling the server, add skipFetch (true) and react to the outputs yourself.- Without URL sync, the filter state is not restored from a link or on page reload. If you need that, either keep the default behaviour or save the state yourself from the output events.
Default is
false for both inputs, so a standard list page behaves as before.
Documentation: Filter Bar Edited by user
11 days ago |
Reason: fixed in 1.8.2