I want to add another function to get result from a CanJs Model
i Have something like this:
VideomakerModel = can.Model({
id:'ID',
findAll: 'GET /videomakers/',
findNear: function( params ){
return $.post("/get_near_videomakers/",
{address:params.address},
undefined ,"json")
}
},{});
VideomakerModel.findNear({address : "Milan"}, function(videomakers) {
var myList = new VideomakerControl($('#accordionVm'), {
videomakers : videomakers,
view: 'videomakersList'
});
});
If I name the method findAll it works correctly, otherwise naming it findNear it never reach the callback
should I extend MODEL is some way?? is there a way of add a function like FindAll?
thank you very much
CanJS only adds the conversion into a Model instance for the standard
findOne
,findAll
etc. Model methods. You will have to do that yourself in your additional implementation by running the result throughVideoMaker.model
(for a single item) orVideoMaker.models
(for multiple items):If I understand the question, it is necessary to do so: