I\'m learning Backbone.
I want to create a list that can contain different models, with different attributes.
For example, listing folder contents, which co
var bannedList = app.request('rest:getBan');
var whiteIpList = app.request("rest:getWhite");
var whiteGroupList = app.request("rest:....");
$.when(bannedList, whiteIpList, whiteGroupList).
done(function (bannedList, whiteIpList, whiteGroupList) {
var collection = new Backbone.Collection();
collection.add(bannedList);
collection.add(whiteIpList);
collection.add(whiteGroupList);
});
app.reqres.setHandler("rest:getBannedList", function (data) {
return API.getBannedList(data);
});
getBannedList: function (data) {
var user = new Backbone.Model();
user.url = '/banned';
user.cid = 'bannedList';
var defer = $.Deferred();
user.fetch({
type: 'GET',
data: data,
success: function (data) {
defer.resolve(data);
},
error: function (data) {
defer.reject(data);
}
});
return defer.promise();
},