gisdev
gisdev

Reputation: 1

dgrid 1.2.1 OnDemandGrid not firing request when scrolling

I'm using dgrid 1.2.1 OnDemandGrid, and with it have tried both dstore 1.1.1 and 1.1.2 (Rest, SimpleQuery, Trackable). It seems no matter what I try I am unable to get the virtual scrolling to work.

My store is defined as:

seStore = new declare([Rest, SimpleQuery, Trackable])({
    target: appUrl + "api/GET_ITEMS",
    idProperty: "SID",
    sortParam: "sort",
    useRangeHeaders: true  
});

Defined with the store is a method for the sorting and filtering:

seStore.getSECollection = function (sortFieldName, desc) {
    var sFilter = {};
    if (sArea != "") {
        sFilter.AREA = sArea;
    }
    var coll = seStore.filter(sFilter).sort({ property: sortFieldName, descending: desc });

    return coll;
}

Grid:

// Create a Grid instance 
seGrid = new (declare([OnDemandGrid, Selection, DijitRegistry, Selector, Keyboard, Editor, ColumnHider, ColumnResizer, ColumnReorder]))({
    id: "seGrid",
    idProperty: "SID",
    cellNavigation: true,
    columns: seColumns,
    collection: seStore.getSECollection("SID", true),
    region: 'center',
    selectionMode: "multiple",
    keepScrollPosition: true,
    query: { responseType: "json" },
    getBeforePut: false,
    farOffRemoval: Infinity, // larger than total height of data; never remove rows
    minRowsPerPage: 25, // request more data at a time
    maxRowsPerPage: 50,
    pagingMethod: 'throttleDelayed',
    queryRowsOverlap: 0,
    //loadingMessage: "Loading data...",
    noDataMessage: "No results found.",
    showFooter: true
});

And backend REST service response provides the correct response where rItems is an array of items from my database query and rTotal is the total number of items in the database for this query:

HttpResponseMessage rm = new HttpResponseMessage(HttpStatusCode.OK);
string dgrJsonResults = Newtonsoft.Json.JsonConvert.SerializeObject(rItems, Formatting.None);
rm.Content = new StringContent(dgrJsonResults, System.Text.Encoding.UTF8);
rm.Content.Headers.ContentRange = new ContentRangeHeaderValue((long)start, (long)count, rTotal) { Unit = "items" };

The grid initally loads correctly with the first 25 items requested, but after this initial request once I scroll down to the bottom (item 25), a request to get the next range of data is not fired.

Can someone please help point me in the right direction?

Upvotes: 0

Views: 110

Answers (0)

Related Questions