如何以一定的间隔刷新EXT JS窗口?

时间:2012-04-19 08:11:11

标签: javascript extjs

    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);

现在将此数据添加到Ext Js窗口:

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'}                                         
                                    ]
                            }
                        ]
                });  

现在,我如何在特定时间间隔刷新窗口而不是页面?

1 个答案:

答案 0 :(得分:1)

试试这个:

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