Closed duarnad closed 12 years ago
Hi Arnaud,
Thanks for the feedback. There shouldn't be anything (that I know of) that would limit you to only having a single datasource per model. To investigate the problem you're having, I've put together a small sample that demonstrates two datasources applied to a single model [http://jsfiddle.net/craigcav/8vqXv/] - seems to work as expected.
What problems are you seeing? Is there an error being thrown?
Craig
Craig,
Thanks for this fast answer ! In fact the problem really was with me : in the two functions that I use to get the data I had this code : function a() { self=this; // I forgot the var keyword here !!! //inside asynchronous ajax request code self(result); }
function b() { self=this; // I forgot the var keyword here !!! //inside asynchonous ajax request code self(result); }
and, well, as self was overriden in the end the second result was overriding part of the first result...
Thanks again ! Arnaud
Hi,
When I use your code, it works very well when I have one object with a datasource, but not as soon as I have two. For example I have : self.utilisateurs = ko.observableArray([]).extend({ datasource: getUtilisateurs, pager : {limit:3} }); (and the associated functions and html code), and it works. But if i add this one self.etablissements = ko.observableArray([]).extend({ datasource: getEtablissements, pager : {limit:3} }); The first one start not working : empty rows are added. Is it normal behavior as it is not supposed to work with two, or do I have another problem ?
Thanks, Arnaud