Created
October 18, 2016 18:52
-
-
Save onechiporenko/ab3b1886dd3bd0e9e9afdfe3a3b46bf1 to your computer and use it in GitHub Desktop.
Models Table. Custom filter function example
This file contains hidden or 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.Controller.extend({ | |
appName: 'Models Table. Custom filter function example' | |
}); |
This file contains hidden or 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.Controller.extend({ | |
columns: [ | |
{ | |
propertyName: 'book.name', | |
title:'Title' | |
}, | |
{ | |
propertyName: 'book.editor.name', | |
title: 'Editor' | |
}, | |
{ | |
propertyName: 'book.year', | |
title: 'Year' | |
}, | |
{ | |
template: 'custom/languages', | |
title: 'Text Language', | |
propertyName: 'languages', | |
filterFunction(cell, neededStr, obj) { | |
return !!obj.languages.filter(({name}) => name.includes(neededStr)).length; | |
} | |
} | |
] | |
}); |
This file contains hidden or 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 config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('my-route'); | |
}); | |
export default Router; |
This file contains hidden or 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({ | |
beforeModel() { | |
return this.transitionTo('my-route'); | |
} | |
}); |
This file contains hidden or 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({ | |
model() { | |
return [ | |
{ | |
book: { | |
id: 1, | |
name: 'My book', | |
year: 2016, | |
editor: { | |
name: 'me' | |
} | |
}, | |
languages: [ | |
{name: 'ru'}, | |
{name: 'en'} | |
] | |
}, | |
{ | |
book: { | |
id: 2, | |
name: 'My book 2', | |
year: 2017, | |
editor: { | |
name: 'not me' | |
} | |
}, | |
languages: [ | |
{name: 'ru'} | |
] | |
} | |
]; | |
} | |
}); |
This file contains hidden or 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
{ | |
"version": "0.10.6", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.8.0", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": { | |
"ember-models-table": "1.9.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment