Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid auto refresh at some interval using Timer.setTimeout

    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.

    #2
    Any suggestion? Thanks.

    Comment


      #3
      Possibly you are just confused about Strings vs Booleans in JavaScript? They are different types, and:

      Code:
      true == "true"
      .. is false.

      We also have a public wiki article showing how to periodically refresh a ListGrid (with no brief flash).

      Comment


        #4
        Originally posted by Isomorphic View Post
        Possibly you are just confused about Strings vs Booleans in JavaScript? They are different types, and:

        Code:
        true == "true"
        .. is false.

        We also have a public wiki article showing how to periodically refresh a ListGrid (with no brief flash).
        The link is pretty helpful. Thanks a lot.

        Comment

        Working...
        X