Last active
August 29, 2015 14:10
-
-
Save straydogstudio/9d1b6675de621f8f4a76 to your computer and use it in GitHub Desktop.
Ember-CLI-101 sortable issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.ActiveModelAdapter.extend({ | |
namespace: 'api/v4', | |
coalesceFindRequests: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.ArrayController.extend({ | |
sortAscending: false, | |
sortBy: 'fullName', | |
sortProperties: Ember.computed('sortBy', function() { | |
return [this.get('sortBy')]; | |
}), | |
actions: { | |
setSortBy: function(fieldName) { | |
console.log('setting sort by to '+fieldName); | |
this.set('sortBy', fieldName); | |
this.toggleProperty('sortAscending'); | |
return false; | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
articles: DS.hasMany('article', {async: true}), | |
email: DS.attr('string'), | |
firstName: DS.attr('string'), | |
lastName: DS.attr('string'), | |
totalArticles: DS.attr('number'), | |
twitter: DS.attr('string'), | |
fullName: Ember.computed('firstName', 'lastName', function() { | |
return this.get('firstName') + ' ' + this.get('lastName'); | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
queryParams: { | |
sortBy: { | |
refreshModel: true | |
}, | |
sortAscending: { | |
refreshModel: true | |
} | |
}, | |
model: function() { | |
return this.store.find('friend'); | |
}, | |
actions: { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment