3.2.0

Virtual mode and JSON webservice

I'm trying to realize a grid in virtual mode that updates it's content when the grid scrolls, just like the virtual mode. But instead of loading the data from one big array or CSV file, I want the data to be updated from a JSON webservice that returns the celldata array. Is there a way to intercept an AW method that loads the next set of data to call this webservice?
Peter de Vries
January 8,
Maybe this could help -

http://www.activewidgets.com/javascript.forum.13524.9/when-will-ajax-paging-be.html
Alex (ActiveWidgets)
January 9,
Alex,

Thanks for the reply. But I don't quite get the sample provided. I'm using ASP.NET AJAX for my webservices. So I don't need AW to fetch any data, I can take care of that myself. What I want is a method I can override so when my grid is scrolled, this function is called and I can fetch fresh data. Something like:

<warning: pseudo-code>

var obj = new AW.UI.Grid;
obj.setId("myGrid");

//set other properties here...

obj.onScrollSoFetchNewData = function(startRow, endRow)
{
//call my webservice here with startRow and endRow parameters...
};

</warning: pseudo-code>

The startRow and endRow parameters should of course be based on the position of the scrollbar at that moment. Can you provide a sample of how something like this can be accomplished?
Peter de Vries
January 9,
You can use onScrollTopChanged(pixelOffset) event, but you have to calculate startRow and endRow using rowHeight property.

Alternatively you can assign a function as a data source, like

grid.setCellText(function(col, row){
...
});

- if row is not loaded yet, return empty string and refresh later when data arrives.
Alex (ActiveWidgets)
January 10,

This topic is archived.

See also:


Back to support forum