Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ListGrid stuck in "Data Loading" when fetchData is called before the first finishes

$
0
0
SmartClient Version: v9.0p_2013-11-03/PowerEdition
Browsers: IE 8-10, Chrome 32, probably others

I have a ListGrid that fetches data from a DataSource based on user interaction with other components. Sometimes the user initiates another fetchData before the previous call to fetchData has completed. Whenever this happens the grid gets stuck in a "Loading Data" state.

There are no errors that occur on the server side and I can see the data coming back to the client just fine. The fetchData callback method for both fetchData requests also gets called without a problem. But the ListGrid never displays the rows. It just continues showing the "Loading Data" message.

You can duplicate this behavior by modifying the code in the example:
http://www.smartclient.com/#databoundFetch

isc.ListGrid.create({
ID: "countryList",
width:500, height:224, alternateRecordStyles:true,
dataSource: worldDS,
// display a subset of fields from the datasource
fields:[
{name:"countryCode"},
{name:"countryName"},
{name:"capital"},
{name:"continent"}
],
sortFieldNum: 1, // sort by countryName
dataPageSize: 50,
drawAheadRatio: 4
})

isc.IButton.create({
left:1, top:240, width:160,
title:"Fetch Double",
click: function() {
countryList.fetchData(
{continent:'Europe'},
function(dsResponse, data, dsRequest){
isc.say('callback 1 '+dsRequest.clientContext.getDataSource().ID);
},
{clientContext: countryList}
);
setTimeout(function() {
countryList.fetchData(
{continent:'Africa'},
function(dsResponse, data, dsRequest){
isc.say('callback 2 '+dsRequest.clientContext.getDataSource().ID);
},
{clientContext: countryList}
);
}, 100);
}
})

Any suggestions on why this might be happening and the best way to prevent the grid from getting stuck in the "Data Loading" state?

Viewing all articles
Browse latest Browse all 4756