1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    19
    Vote Rating
    0
    x0ner is on a distinguished road

      0  

    Default Refreshing grid with ajax calls

    Refreshing grid with ajax calls


    Does Extjs have something similiar to this:

    Code:
        var tmFunc = function(){ store.reload(); }; 
        setTimeout(tmFunc, 1000);
    On initial load one of my portlets goes out, makes an ajax call and then loads the data into a grid. This data changes throughout the day, so I want to make sure I update it every so often by calling back to the server. Is there a way to do this? I saw you can add a refresh button, but I would rather have this happen automatically.

    Here is my load request:
    Code:
    	var myData = Ext.Ajax.request({
    	    url: 'controls/queries/stuff.php',
    	    method:'GET', 
    	    waitTitle:'Connecting', 
    	    waitMsg:'Getting data...',
    	    
    	    success:function(request){ 
    	    	var obj = Ext.util.JSON.decode(request.responseText); 
    	    	store.loadData(obj);
    	   },
    	});

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    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


    why use Ext.Ajax.Requesty, when the store can use the data store's built in http proxy to pull the data for you? All you have to do is setup a delayed task that starts the cycle of loading on a timed event. The load of the store should start the delayed task again.

  3. #3
    Sencha User
    Join Date
    Dec 2010
    Posts
    19
    Vote Rating
    0
    x0ner is on a distinguished road

      0  

    Default Makes sense...

    Makes sense...


    Alright, so I am going to take that advice and started implementing it:

    Code:
    	var cm = new Ext.grid.ColumnModel([ 
    		{ id :'daily_bad_filter_date', header : 'Date', width : 160, sortable : true, dataIndex: 'date' },
    		{ header : 'Event', width : 200, sortable : true, dataIndex: 'event' },
    		{ header : 'Victim', width : 120, sortable : true, dataIndex: 'victim' },
    		{ header : 'Attacker', width : 120, sortable : true, dataIndex: 'attacker' },
    		{ header : 'Notes', width : 170, sortable : true, dataIndex: 'notes'}
    	]);
    	cm.defaultSortable = true; 
    
    	var store = new Ext.data.Store({
    		proxy: new Ext.data.HttpProxy({url: 'controls/queries/daily_bad_filtered.php'}),
    	    reader: new Ext.data.JsonReader({
    	        id: 'notes'
    	    }, [
    		       {name: 'date'},
    		       {name: 'event'},
    		       {name: 'victim'},
    		       {name: 'attacker'},
    		       {name: 'notes'}
    	    ])
    	});
    	
    	store.loadData();
    I believe that is in the right direction, but where would be the best spot to add the timer function? Would you wrap it around the store load?

Similar Threads

  1. Ext.Ajax : Blocking Multiple (not wanted) Ajax calls
    By mortazza in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 29 Sep 2010, 7:57 AM
  2. Ajax Calls twice
    By garraS in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 27 Mar 2009, 8:27 AM
  3. Ajax calls
    By kheiron in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 7 Mar 2008, 5:06 AM
  4. Grid populated with data from various ajax calls
    By kgm in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 18 Jan 2008, 8:20 AM

Thread Participants: 1

Tags for this Thread

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..." hd porno faketaxi