Javascript ExtJS-更新DIV后无法再次渲染窗口
我使用renderTo-config将ExtJs窗口呈现到DIV中。但是,有一些AJAX函数可以用其他HTML内容覆盖同一个DIV。我在控制台中没有错误 我必须刷新整个页面,使其再次呈现。我怀疑我必须在更新DIV之前销毁该组件,但我尝试的所有操作都不起作用 这是我的windows代码(其中有一些django标记): 编辑: 这是显示窗口(或面板)的ajax函数:Javascript ExtJS-更新DIV后无法再次渲染窗口,javascript,ajax,extjs,Javascript,Ajax,Extjs,我使用renderTo-config将ExtJs窗口呈现到DIV中。但是,有一些AJAX函数可以用其他HTML内容覆盖同一个DIV。我在控制台中没有错误 我必须刷新整个页面,使其再次呈现。我怀疑我必须在更新DIV之前销毁该组件,但我尝试的所有操作都不起作用 这是我的windows代码(其中有一些django标记): 编辑: 这是显示窗口(或面板)的ajax函数: 通常不会将窗口呈现给div。窗口是绝对定位的,Ext管理何时何地创建其标记。如果希望在创建时显示窗口,则可以使用autoShow:tr
通常不会将窗口呈现给div。窗口是绝对定位的,Ext管理何时何地创建其标记。如果希望在创建时显示窗口,则可以使用
autoShow:true
对其进行配置;如果希望稍后显示,则在创建窗口后调用window.show()
。确定,但即使使用面板而不是窗口,如果div已更新,也无法再次显示面板。确定,如果面板的标记已销毁,则无法再次显示。这是预期的行为。将其渲染为空div;不要把任何其他东西放在它上面。我正在考虑这个问题,在执行document.body.appendChild(js)时,问题可能在ajax函数中;
Ext.require([
'Ext.state.Manager',
'Ext.state.CookieProvider',
'Ext.window.MessageBox',
'Ext.window.Window',
'GeoExt.panel.Map'
]);
Ext.onReady(function(){
Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider', {
expires: new Date(new Date().getTime()+(1000*60*60*24*7)) //7 days from now
}));
map = new OpenLayers.Map('map',
{ projection: new OpenLayers.Projection("EPSG:3857"),
numZoomLevels: 20 });
tiledLayer = new OpenLayers.Layer.XYZ('TMS',
"{{ tmsURL }}1.0/layer/{{ shapefile.id }}/${z}/${x}/${y}.png"
);
map.size = new OpenLayers.Size(1000,800);
map.addLayer(tiledLayer);
var bounds = new OpenLayers.Bounds.fromArray({{ bounds }});
map.zoomToExtent(bounds);
var click = new OpenLayers.Control.Click();
map.addControl(click);
click.activate();
controls = new OpenLayers.Control.Hover({
handlerOptions: {
'delay': 100
}
});
map.addControl(controls);
controls.activate();
var mappanel = Ext.create('GeoExt.panel.Map', {
id: 'mappanel',
map: map,
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [{
text: 'Current center of the map',
handler: function(){
var c = GeoExt.panel.Map.guess().map.getCenter();
Ext.Msg.alert(this.getText(), c.toString());
}
}]
}]
});
mapWindow = Ext.create('Ext.window.Window', {
title: "Layer: {{ shapefile }} | Click on feature to edit.",
id: 'mapWindow',
x: 350,
y: 120,
height: 800,
width: 1000,
renderTo: 'pageContent',
floatable: true,
collapsible: true,
closable: true,
bodyBorder: false,
maximizable: true,
shadowOffset: 6,
layout: 'fit',
items: [
mappanel
]
}).show();
{% load mathfilters %}
attrTable = new Ext.create('Ext.window.Window', {
id: 'attrTable',
title: "Feature's attribute(s)",
bodyStyle: {
background: '#f2f3f7',
padding: '10px'
},
x: 1400,
y: 120,
height: 200,
width: 300,
renderTo: 'pageContent',
collapsible: true,
closable: true,
autoScroll: true,
bodyBorder: false,
shadowOffset: 6,
layout: 'fit',
html: "",
}).show();
});
layerViewer = function(node_id){
Ext.Ajax.request({
method: "GET",
url: "/basqui/layer/shapefile/view/" + node_id + "/",
success: function(r){
html = Ext.decode(r.responseText).html
code = Ext.decode(r.responseText).js
var js = document.createElement('script');
js.text = code;
document.body.appendChild(js);
Ext.get('pageContent').update(html);
}
});
}