lundi 7 décembre 2015

Modularized approach for handling multiple filters on a Page in Ember js

I have a fairly complicated list which I need to filter (state, tags, name, categories) and sort. Some of the filter properties allow multi selection (eg: categories, tags) and some are single selection (eg: state). I have many more pages coming in pipeline which fit in the same category.

Now I have already build various components for filtering and sorting but facing issues in storing states of the various filter and sort selections.

Since filters generally fits into a category of key - value pair which can be applied on collection I want to isolate this logic from controller and put somewhere in a mixin / service.

For example whenever there is a change in selection in filter / sort I'm planning to send an action to parent controller from the component and update the state of the same (expecting this to happen automatically - may be by using naming convention or some other means) and components would be observing on some controller property and updates itself based on the change.

Now my question is how to implement this kind of feature in controller in Ember way so that I don't have to write boilerplate in every controller.

Disclaimer : Ember newbie migrated from backbone - marionette




Aucun commentaire:

Enregistrer un commentaire