Created
March 9, 2012 17:16
-
-
Save alivedise/2007610 to your computer and use it in GitHub Desktop.
$.Model: 2 or more models Combination
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
| $.Model('jQuery.Modelex', { | |
| findAll: function(params, success, error){ | |
| return $.when(A.findAll({}), B.findAll({})).done(success).fail(error); | |
| }, | |
| models: function(dataA, dataB){ | |
| var data = $.extend({}, dataA, dataB); | |
| var array = []; | |
| $.each(data, function(index, value){ array.push(new this(value)) }); | |
| return array; | |
| } | |
| }, { | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment