|
export default DS.Model.extend({
title: DS.attr(),
artist: DS.attr(),
songCount: DS.attr()
});
|
|
model() {
this.store.push({
data: [{
id: 1,
type: 'albums',
attributes: {
title: 'Fewer Moving Parts',
artist: 'David Bazan',
songCount: 10
},
relationships: {}
}, {
id: 2,
type: 'albums',
attributes: {
title: 'Calgary b/w I Can\'t Make You Love Me/Nick Of Time',
artist: 'Bon Iver',
songCount: 2
},
relationships: {}
}]
});
}
|
|
model() {
var dataColl = [];
this.store.findAll('albums').then(function(album) {
album.map(function(x) {
dataColl.push(x.toJSON());
});
});
return {
data : dataColl,
fieldsvalues: { dataSource: dataColl, text: 'artist', value: 'artist' },
value: 'Bon Iver',
width: "100%"
}
}
|
|
{{ej-dropdownlist id="dropdownlist" e-dataSource=model.data e-fields=model.fieldsvalues e-width=model.width e-value=model.value}}
|
|
[application.hbs]
{{ej-grid id="Grid" e-dataSource=model.data e-columns=model.cols e-allowPaging=true e-actionBegin=model.actionBegin e-editSettings=model.edit e-toolbarSettings=model.toolbar }}
[application.js]
actionBegin: function(args){
if(args.requestType == "save" && !this.element.find(".e-addedrow").length){
//Update on Ember data
}
else if(args.requestType == "save" && this.element.find(".e-addedrow").length){
//Insert on Ember data
}
else if(args.requestType == "delete"){
//Delete on Ember data
}
}, |