简体   繁体   中英

How to refresh EXT JS window at certain interval?

    var xmlhttp=new XMLHttpRequest(); 
    xmlhttp.open("GET",urls,false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML; 
    var t = xmlDoc.getElementsByTagName("FeatureCollection");
    var store = new Ext.data.SimpleStore({
                                    fields: [
                                       'vendor'                                                            
                                    ]
                                });

    var reload = function() {                 
              store.loadData(t);
            }
            setInterval(reload , 5000);

Now added this data to Ext Js window:

var window =  new Ext.Window({
                    title: "",
                    width: 200,
                    height:200,
                    layout: "fit",
                    collapsible: true,
                    autoScroll:true,
                    maximizable: true,
                    items: [
                        {
                                id:'legend-panel', 
                                xtype: "grid",
                                ref: "capsGrid", // makes the grid available as app.capsGrid
                                title: "Sites",
                                region: "north",
                                height: 100,
                                viewConfig: {forceFit: true},
                                store: store,
                                columns: [
                                        {header: 'Vendor', width: 200, sortable: true, dataIndex: 'vendor'}                                         
                                    ]
                            }
                        ]
                });  

Now, How would I refresh the window only not page at certain time interval?

Try this one:

var reload = function() {
  store.loadData(t);
}
setInterval(reload, 1000);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM