SlickGrid icon indicating copy to clipboard operation
SlickGrid copied to clipboard

Runtime error "undefined" object when using Server-side paging in dataview

Open hksan01 opened this issue 8 years ago • 2 comments

I hope i'm not using it wrong. I'm using the code from example6 but with a dataview. After the line dataView.setItems(loader.data,"uid"); runs, it lands on updateIdxById(startingIndex). where the error is thrown when the items.length is 1000, but we only have 50 items loaded. so the items[i][idProperty] is undefined when 'i' hits 50 and on.

function updateIdxById(startingIndex) { startingIndex = startingIndex || 0;
var id;

  for (var i = startingIndex, l = items.length; i < l; i++) {
	
    id = items[i][idProperty];
    if (id === undefined) {
      throw "Each data element must implement a unique 'id' property";
    }
    idxById[id] = i;
  }
}

this is the first exception, there are couple more places follow the same pattern.

Appreciate if anyone can shred some light on this.

hksan01 avatar Feb 08 '17 16:02 hksan01

This is a fairly tricky change (going to a DataView). I can put together a new example page for it. Could you post your source and remotemodel code.

6pac avatar Feb 09 '17 01:02 6pac

I still mainly using the example6 code, remotemodel remains untoched. In the index.html, i use dataView.setItems(loader.data) when loader.onDataLoaded.subscribe(...) is executed from callback.

I have version 2.3.2.

The reason I want to do that using DataView is I want to use Footer Paging (0/25/50) and Header row filtering with Server-side paging. And I haven't produce a listening server call yet, using the "http://octopart.com/api/v3/parts/search?..." seems to return correct data and page index.

I'm open to any suggestion or work around. Thx alot!

index.txt

hksan01 avatar Feb 09 '17 02:02 hksan01

closing since this is rather old and probably outdated, also the octopart no longer works anonymously (without a registered API id)

ghiscoding avatar Sep 20 '23 14:09 ghiscoding