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

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

4

1 回答 1

1

试试这个:

var reload = function() {
  store.loadData(t);
}
setInterval(reload, 1000);
于 2012-04-19T08:17:31.497 回答