Results 1 to 5 of 5

Thread: Add 1 row every n seconds to grid

  1. #1
    Ext User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
      0  

    Default Add 1 row every n seconds to grid

    Hi everybody, I trying to migrate a flash application to extjs, this is what my flash app does, it basically request to a webservice app data every 5 seconds and add the new data to the top of a grid, it use flashremoting so everything goes through classes.

    Now I know we can get external data using urls, I already have some php files that response xml data, then I will need something like this:

    1) The firts time the grid will request every 5 seconds to the php file for a new record on the database who has the timestamp higher than the hour when we opened the grid, some request like the following url: getdata.php?time=20090720_15:24:24

    2) When we get data that fits filter above, the grid will keeps requesting data to the php file every 5 seconds but with the last record id, ,url: getdata.php?lastid=200944564 .

    3) Every request can response more than 1 record and all the new records will be adding at the top of the grid.

    Thanks

  2. #2
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    9
      0  

    Post

    Use the TaskMgr to make a periodic call like

    Code:
    this.loadingTask = {
       run: function(){
          // do your request here and add data to the store
      },
      interval: 5000,
      scope: this
    };
    
    Ext.TaskMgr.start(this.loadingTask);
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Ext User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
      0  

    Default

    How do I add the data @ the top of the grid?

    Thanks

  4. #4
    Sencha User MD's Avatar
    Join Date
    Mar 2007
    Posts
    178
    Vote Rating
    0
      0  

    Default

    You add the new records to the store that is associated with the grid, then call a refresh on the gridview.

    The API docs are there to help you know http://extjs.com/deploy/ext-3.0.0/docs/

  5. #5
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    Quote Originally Posted by MD View Post
    You add the new records to the store that is associated with the grid, then call a refresh on the gridview.

    The API docs are there to help you know http://extjs.com/deploy/ext-3.0.0/docs/
    you shouldn't have to manually refresh the GridView if you're adding new Records to the grid's Store (or updating/removing existing Records even) -- this is already handled automatically for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •