2012-01-26 55 views
3

我正在使用dojo ContentPane來渲染一個openlayers地圖。當DOM準備就緒並且插入地圖時,dijit的格式將被覆蓋。我已經嘗試通過類和id在CSS中指定高度和寬度,並且也在我的html中內聯。Dojo data-dojo-props樣式被覆蓋

我的HTML:

<div id="map-id" 
class="centerPanel" 
    data-dojo-type="dijit.layout.ContentPane" 
    data-dojo-props="region: 'center', style: 'width: 1468px;'"> 
</div> 

我的CSS:

#map-id { 
width: 1468px; 
height: 471px; 
} 
.centerPanel { 
width: 1468px; 
height: 471px; 
} 

我從螢火蟲實際的HTML:

<div id="map-id" class="centerPanel dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter olMap" data-dojo-props="region: 'center', style: 'width: 1468px;'" data-dojo-type="dijit.layout.ContentPane" title="" role="group" dir="ltr" style="width: 1455px; left: 252px; top: 48px; right: auto; bottom: auto; height: 456px;" widgetid="map-id"> 

正如你可以看到我的數據道場道具造型ignorded並且新的高度和寬度被插入...任何想法?

+0

聽起來好像你的ContentPane在BorderContainer內部,在這種情況下,父級佈局部件(BorderContainer)很可能指定了子級ContentPane的大小。也許提供一個更完整的例子來說明你想要做什麼會讓我們有更多的工作來幫助。 –

回答

0

您可能需要您的容器上添加doLayout:false,如果有的話:)

0

一個使用BorderContainer的中心區域被大小,以填補任何可用的剩餘空間。如果你希望你的中心區域是一個特定的尺寸,那麼你需要設計BorderContainer的樣式,而不是佔據中心區域的部件。

1

我已經在dojo網格中嘗試了這一點,它也不起作用。我建議你嘗試使用JavaScript代碼。

改爲在容器對象中添加一個帶寬度和高度屬性的樣式對象。

myGrid = new DataGrid({ 
    store: myObjectStore, 
    structure : myStructure, 
    style: { 
     width: '1000px', 
     height: '500px', 
    }, 
}, "myGrid"); 

我相信聲明方式不起作用。