Refreshing grid in background + pagination

Hi,

I need to refresh a grid in background. Currently, i’m using this code:

grid.dataSource.fetchData(null, function(dsResponse, data, dsRequest) {
            resultSet = isc.ResultSet.create({
                dataSource: dsRequest.dataSource,
                allRows: data
            });
            
            grid.setData(resultSet);
            grid.dataArrived();
        }, {
            showPrompt: false
        });

This works fine unless i’m using pagination, because grid considers that data variable contains all rows.

How can i properly create a result set with pagination options?

I tried:

resultSet = isc.ResultSet.create({
                dataSource: dsRequest.dataSource,
                fetchMode: 'paged',
                fetchStartRow: dsResponse.startRow,
                fetchEndRow: dsResponse.endRow,
                localData: data,
                totalRows: dsResponse.totalRows
            });

But it doesn’t work correct. In this case, grid shows 1000 rows, but it only contains 75.

Thanks!

See ResultSet.initialLength (and in general, read docs before trying to set internal properties).

Hello,

Thanks for the reply. Any ideas of why it makes 2 XHRs in this case?

Happens right after setData() call and the 2 XHRs seems identical ( same post parameters as well as response ).