Sorting records for a route

I want to reset a model on a route after a user clicks the sort header on a table:

import Ember from 'ember';
//import _ from 'lodash';

export default Ember.Route.extend({
	needs: 'event-profile',
	model: function(){
		var parentmodel = this.modelFor('eventProfile').get('slug');
		return this.store.find('listingEvent', { eventInstanceSlug: parentmodel, skip: 0, limit: 20 });
  },
  actions: {
		orderByStart: function(){
			this.set('loading', true);
			console.debug('order by start');
			var _this = this;
			var parentmodel = this.modelFor('eventProfile').get('slug');
			this.store.find('listingEvent', { eventInstanceSlug: parentmodel, skip: 0, limit: 20, sort: 'start' })
			.then(function(model){
				_this.set('loading', false);
				_this.set('model', model);
			});
		}
	 }
});

orderByStart is getting fired and i can see the correct data is being returned but setting the model with _this.set('model', model); doesn’t seem to have any effect?

What is the proper way to go about this?

I think you have to grab the controller and then set the model.

_this.controllerFor('name of your route').set('model', model)

You have defined the actions function inside the route. Therefore “_this” refers to the route not the controller. Either you move the actions function inside the route’s controller or you access the controller via controllerFor as controllerFor(‘route’).set(‘model’, model);

thanks guys _this.controllerFor was the way forward