jeudi 12 octobre 2017

Ember Sort my Records so the null for a column are retuned first

I want to filter and then sort my ember records such that the null records for a column are returned first. I'm not much familiar with ember and have a rails back ground.

filteredByData = myLeads.filterBy('status', 'open').filterBy('doNotCall', false).filterBy('phoneValid', true)

filtered = filteredByData.sortBy 'last_dialed_at', 'last_name', 'first_name', 'id'

Right now, my records are getting ordered according to the id.

What i want is to implement the NULLS LAST/FIRST from sql in any query (such a s SELECT * FROM t1 ORDER BY c1 DESC NULLS FIRST here in my sort so i get the records such that the last_dialed_atnull records come first.

Any help will be appreciated. Thanks in Advance.

P.S: I'll try to create a ember twiddle mean while to explain myself better.




Aucun commentaire:

Enregistrer un commentaire