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:

  1. old data
  2. old data
  3. old data
  4. 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

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -