Q:

Paging does not work with computed array with Knockout Js

I am learning Knockout, and trying to figure out why paging is not working for the computed observable array I created.
This code originally used just observable arrays, but I found that chaining computed make the code a little easier with paging and searches thrown at it. 
http://jsfiddle.net/yustas2/sjLeospx/16/
   self.PageSize = 3;
   self.CurrentPage = ko.observable(0);
   self.PageData = ko.computed(function() {
     //alert('current page*size' + self.CurrentPage() * self.PageSize + ' ' + self.PageSize);
     //alert(ko.toJSON(self.Products.slice(self.CurrentPage()*self.PageSize, self.PageSize)));
     return self.Products.slice(self.CurrentPage() * self.PageSize, self.PageSize);
   }, self);
   self.PageCount = ko.computed(function() {
     return Math.ceil(self.Products().length / self.PageSize);
   }, self);
   self.Pages = ko.computed(function() {
     return new Array(self.PageCount());
   }, self);

   self.GoToPage = function(data) {
     self.CurrentPage(data());
   };

I don't know how much code I should paste here, but all of it is on jsfiddle.
Basically, what I see is happening is data is loading and the first page displays ok. When I try to switch the pages, the slicing of original array does not work, until I come back to the first page. 
I have a suspicion that having currentpage as observable does not push the computed chain along, although it does change. 
Thank you.

A:

Replace your function with:
self.PageData = ko.computed(function() { 
    var sliceFrom =self.CurrentPage()*self.PageSize; // this is the first for each page
    var sliceTo = (self.CurrentPage()*self.PageSize)+self.PageSize; // first of page + pageSize

    return self.Products.slice(sliceFrom ,sliceTo);
}, self);

So this fixes your slicing, by slicing from the first item that should reside within that list count + the actual page size that you require each time.
EDIT:
Also in your fiddle remove this line
self.CurrentPage(0);

After pushing the new products inside self.Load(), and run this line after your ko.utils.arrayForEach call to pushing products in the array, you only need to set the current page once after you load the data

