Last active
August 29, 2019 13:12
-
-
Save onechiporenko/c8995fdd91788b165b63d5b10906f38c to your computer and use it in GitHub Desktop.
Custom filter with date
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.Component.extend({ | |
options: Ember.computed('column.filterOptions.[]', function() { | |
return this.get('column.filterOptions').map(opt => { | |
return {value: opt.value, label: opt.label ? new Date(opt.value).getFullYear() : ''}; | |
}).uniqBy('label'); | |
}) | |
}); |
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: 'Ember Twiddle' | |
}); |
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({ | |
data: [ | |
{id: '1', date: new Date(1567058063000)}, | |
{id: '2', date: new Date(1535518463000)}, | |
{id: '3', date: new Date(1535518163000)} | |
], | |
columns: [ | |
{propertyName: 'id'}, | |
{ | |
propertyName: 'date', | |
filterWithSelect: true, | |
componentForFilterCell: 'filterByDate', | |
filterFunction (cell, filter) { | |
return new Date(cell).getFullYear() === new Date(filter).getFullYear(); | |
} | |
} | |
] | |
}); |
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
export function initialize(appInstance) { | |
appInstance.inject('component:models-table', 'themeInstance', 'theme:ember-bootstrap-v4'); | |
appInstance.inject('component:models-table-server-paginated', 'themeInstance', 'theme:ember-bootstrap-v4'); | |
} | |
export default { | |
name: 'emt-inject-2', | |
initialize | |
}; |
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({ | |
}); |
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.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.4.3", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3", | |
"fa": "https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" | |
}, | |
"addons": { | |
"ember-data": "3.4.2", | |
"ember-models-table": "2.10.1", | |
"ember-bootstrap": "2.8.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment