dimanche 24 juin 2018

Write an Or filter in Ember

I want to write an Or filter in Ember. The filter that I want to implement is as follows:

(end_date <= filter_end_date && end_date >= filter_start_date) || (start_date >= filter_start_date && start_date <= filter_end_date)

I am collecting all the filters together and then passing it while sending the query:

filterOptions: [
    {
      name : 'state',
      op   : 'eq',
      val  : 'published'
    }
  ]

Query is as follows:

return this.get('store').query('event', {
      sort   : 'starts-at',
      filter : filterOptions
    });

I went through the docs but didn't find anything. What is best way to model this filter?




Aucun commentaire:

Enregistrer un commentaire