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

ListGrid auto refresh at some interval using Timer.setTimeout

$
0
0
Version v9.0p_2013-12-19/PowerEdition

I have a listGrid whose ID is: mListGrid

I have falling callback:
Code:

var mCallback = function(dsResponse, data, dsRequest){
    var lResultSet = isc.ResultSet.create({
        dataSource: mListGrid.getDataSource(),
        initialData: dsResponse.data
    });
    mListGrid.setData(lResultSet);

    // set time out
  if(mAutoRefresh == "true")
  {
      isc.Timer.setTimeout("progress()", 5000);
  }
}

Suppose mAutoRefresh is true, and progress function is:
Code:

function progress()
{
    mListGrid.fetchData(mListGrid.getCriteria(), mCallback);
    isc.Timer.setTimeout("progress()", 5000);
}

I'm using the debug tool and find that progress() function is called by every 5 second, but each time, it seems that fetchData() function is not called, because mCallback function is no longer be called.

I also tried to avoid using fetchData(), but using mListGrid.data.invalidateCache(), auto refresh works good, but every time, the grid will flick once, which is not visually good. I still prefer manually call fetchData with callback in the progress() function, because we have some other configuration in the callback function.

Could you please tell what I did is wrong to make mCallback is no longer called. Thanks.

Viewing all articles
Browse latest Browse all 4756

Trending Articles