Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain component state on route transition #115

Open
dipeshpp opened this issue Nov 6, 2017 · 1 comment
Open

Maintain component state on route transition #115

dipeshpp opened this issue Nov 6, 2017 · 1 comment

Comments

@dipeshpp
Copy link

dipeshpp commented Nov 6, 2017

Is there a recommended way to maintain the state of filters/sorts/page on route transition?

I could potentially store this data in a service but I still need to set the actual text in the search boxes for each column. Is there any way to achieve this without dom manipulation?

If there's an option to set default values for filters, sort order, and page number when the component is initialized, that would be great.

@smargovsky
Copy link
Contributor

There is currently not a clean way to do this. You can make use of the externalFilters feature that was very recently added, but you would have to build the UI around filters yourself ( not using the column filters included in the addon ). Or, you can define a custom filter component and use an Ember service to keep track of its state.

Having said that, here is the dirty way to update both of those:
{{fixtable-grid ... currentPage=myCurrentPage filters=myFilters}}
and in your controller:
... myCurrentPage: 3, myFilters: { idOfField: 'textToShowInFieldOrSelectValue } ...

NOTE that this will NOT trigger any data reload, but will dirty bind / set these variables for you. In my limited testing of this hack, onReloadContent doesn't even pass down your filters ( but it does pass the custom set page down ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants