knockout.js - KnockoutJS Appending To the Beginning of observableArray -
i have viewmodel
retrieve data server , new data concatenated data have. problem is, new data goes after old data , want other way around fresh data shows @ top of view.
this have:
self.serverdata(self.serverdata().concat(newdata));
and view displayed as:
- old data
- old data
- old data
- new data
prepend observable arrays using unshift function. modify underlying array , tell observable updated.
var x = ko.observablearray([1,2,3]); x.unshift(0); // x() returns [0,1,2,3]
Comments
Post a Comment