(query-params)
- Basic form
- e.g.
(query-params page=nextPage)
- set
page
tonextPage
- any other QPs on target route get automatically filled in based on model-dependent state
- active state: route considered inactive unless supplied params match
- e.g.
- PROPOSAL: Specify params to reset
- e.g.
(query-params '-sortOrder' page=nextPage)
- Like above, sets
page
tonextPage
, but resets the destination value ofsortOrder
to its default value as originally defined on the controller.
- e.g.
- PROPOSAL: Specify params to preserve
- e.g.
(query-params 'sortOrder' page=nextPage)
- Preserves the current value of
sortOrder
such that it won't be reset according to model dependent state rules. - Note that this is just shorthand for
(query-params sortOrder=sortOrder page=nextPage)
, but has a few benefits: 1) brevity, 2) symmetric API to resetting QPs (described above), and 3)sortOrder
might be defined on a parent controller, which would require aliasing to expose to the current template.
- e.g.
- Basic form
Created
June 2, 2014 14:28
-
-
Save machty/ec52161e47424dd138d2 to your computer and use it in GitHub Desktop.
possible query-params helper enhancements
Is there a way to reset all QP in link-to
? Because reseting multiple parameters using (query-params '-sortOrder' '-page' '-filter')
is not convenient.
This is my proposal for resetting all things:
(query-params '-all')
(queyr-params reset=true)
(query-params page=nextPage reset='filter1,filter2')
In the 3rd choice the page
is set to nextPage
, the sortOrder
is preserved and the filter1
and filter2
are reset to default value.
Also I remember in a Gist there's a query-params-reset
proposal. Is there a reason that it's not good so it's not considered as a solution?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍