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

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -