Web アプリで geoext2 と共に extjs4.1 を使用しています。
ajaxを介してmapPanelをtabPanelにロードし、tabPanelの高さと幅を埋めたいと思います。
mapPanel の高さと幅を設定すると、tabPanel で表示できますが、高さと幅を設定しているため、tabPanel を埋めることはできません。次のコード:
mapPanel = Ext.create("GeoExt.panel.Map", {
renderTo: "mappanel",
height: 575,
width: 1124,
map:map,
zoom: 11,
tbar : toolbar
});
var tabs = Ext.create('Ext.tab.Panel', {
region: 'center', // a center region is ALWAYS required for border layout
deferredRender: false,
activeTab: 0, // first tab initially active
items: [{
title: 'History',
autoScroll: true
}, {
title: 'Center Panel',
autoScroll: true
}]
});
ユーザーが次のコードでアイコンを持つグリッド列をクリックすると、MapPanel を tabPanel に挿入します。
var grid = Ext.create('Ext.grid.Panel', {
store: store,
columnLines: true,
columns: [
{
menuDisabled: true,
sortable: false,
xtype: 'actioncolumn',
width: 20,
items: [{
icon : '<?php echo Yii::app()->baseUrl.'/images/icons/show.png';?>',
tooltip: 'Show Map',
handler: function(grid, rowIndex, colIndex) {
var rec = store.getAt(rowIndex);
var jsonData = Ext.encode(store.proxy.reader.jsonData);
tabs.remove(tabs.getComponent(2));
tabs.insert(2,{
title:'Map',
layout: 'fit',
loader: {
scripts: true,
autoLoad :true,
params:{
history:jsonData,
index:rowIndex
},
failure : function(){
alert('failed');
},
url: '<?php echo Yii::app()->createUrl('MapWidget/HistoryMap');?>'
}
});
tabs.setActiveTab(2);
tabs.doLayout();
}
}]
},
...
しかし、mapPanel オプションで高さと幅を消去すると、tabPanel に表示されません!
mapPanel を tabPanel にロードしてコンテンツを埋めるにはどうすればよいですか?