1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
    Abhi_aec is on a distinguished road

      0  

    Default Auto Refresh Grid

    Auto Refresh Grid


    Hi,


    I m using Sencha Touch 2 MVC and have created a model and store in which read in a json file and it will display in grid.
    I want to auto refresh my grid after every 5 seconds.
    As my understanding, I need to modify my Store, but not able to find out solution.
    I have tried Ext.util.DelayedTask and refresh() but not able to fit it in my store.


    I'm using mitchellsimoens-Ext.ux.touch.grid-70b6861 which I have download from Sencha Market and my requirement is to auto refresh one of the grid column value which is map to my JSON.


    Store:
    Ext.define('App.store.AccntInfoTableStore2', {
    extend: 'Ext.data.Store',

    requires: [
    'App.model.AccntInfoTableModel2'
    ],

    config: {
    autoLoad: true,

    model: 'App.model.AccntInfoTableModel2',

    proxy: {
    type: 'ajax',
    url: 'http://X.Y.Z/TS/resources/data/AccntInfoStoreData2.json'
    }
    }
    });

    Kindly help to resolve it...

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default use setTimeout()

    use setTimeout()


    Hi Abhi,

    You just need to call your refresh() function at a regular right ?
    So you just need to add a setTimeout();
    Code:
       
         setTimeout("refresh()", 1000); 
    

    at the end of your refresh()function. Then you just need to call it when your app startup.
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
    Abhi_aec is on a distinguished road

      0  

    Default


    Hi,


    Can you tell me where exactly in app startup, below is my app.js


    Ext.Loader.setConfig({
    enabled:true
    });
    Ext.application({
    name: 'App',


    requires: [
    'Ext.MessageBox'
    ],


    views: [
    'Main',
    'AccountInfoTable2'
    ],

    models: [
    'TestModel',
    'TableModel',
    'AccntInfoTableModel',
    'AccntInfoTableModel2',
    'AccntInfoTableModel3'
    ],

    stores: [
    'Store',
    'TableStore',
    'AccntInfoTableStore',
    'AccntInfoTableStore2',
    'AccntInfoTableStore3'
    ],

    controllers: [
    'Main'
    ],


    launch: function() {
    console.log('inside launch');
    Ext.Viewport.add(Ext.create('App.view.Main'));
    }
    });


    Kindly modify it accordingly...

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
    Abhi_aec is on a distinguished road

      0  

    Default


    Hi,


    For the reference, below is my view where touchgridpanel is a grid (which I want to auto refresh without pressing any button) and AccntInfoTableStore2 is store which I have previously mentioned.


    Ext.define('App.view.AccountInfoTable2', {
    extend: 'Ext.Panel',
    xtype: 'accountInfoTable2',
    id:'accountInfoTable2',

    requires: [
    'App.store.AccntInfoTableStore2'
    ],

    config: {
    layout:'vbox',

    items:[
    {
    xtype: 'touchgridpanel',
    flex:1,
    store: 'AccntInfoTableStore2',
    features : [
    {
    ftype : 'App.view.feature.Editable',
    launchFn : 'initialize'
    },
    {
    ftype : 'App.view.feature.Sorter',
    launchFn : 'initialize'
    }
    ],
    columns : [
    {
    header : 'Measure',
    dataIndex : 'measure',
    style : 'text-align: center;',
    width : '35%',
    filter : { type : 'string' }

    },
    {
    header : 'Cur',
    dataIndex : 'cur',
    style : 'text-align: center;',
    width : '35%',
    filter : { type : 'string' }
    },
    {
    header : 'Opt',
    dataIndex : 'opt',
    style : 'text-align: center;',
    width : '30%',
    filter : { type : 'string' }
    }
    ]
    }
    ]
    }
    });

  5. #5
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    You need to call setInterval() method afterrender your grid in the controller section like
    Code:
    Ext.define( 'App.controller.Test',{
    extend : 'Ext.app.Controller',
       init: function(){
           this.control({
              '#yourGrid':{
                   afterrender: this.onGridAfterRender
               }
           });
      },
      onGridAfterRender: function(grid){
           setInterval(function(){
              grid.store.load();
           }, 5000);
       }
    }
    )
    and
    Code:
    Ext.application({ name: 'App', ............................ .............................
    controllers:['Main', 'App.controller.Test' ] launch: function() { console.log('inside launch'); Ext.Viewport.add(Ext.create('App.view.Main')); } });
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  6. #6
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    80
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    abhi, pleaes use [ CODE ] [ /CODE ] blocks moving forward.

  7. #7
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
    Abhi_aec is on a distinguished road

      0  

    Default


    Thanks sword!

    Done it, but rather than afterrender, I have used painted event, because afterrender is not available in Sench Touch 2.0

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."