Css Dojo数据Dojo道具样式覆盖

Css Dojo数据Dojo道具样式覆盖,css,openlayers,dojo,styling,Css,Openlayers,Dojo,Styling,我正在使用DojoContentPane渲染openlayers地图。当DOM就绪并插入映射时,dijit的sytle将被覆盖。我已经尝试通过类和id在CSS中指定高度和宽度,并在html中内联 我的html: <div id="map-id" class="centerPanel" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'center', style: 'width: 1468

我正在使用DojoContentPane渲染openlayers地图。当DOM就绪并插入映射时,dijit的sytle将被覆盖。我已经尝试通过类和id在CSS中指定高度和宽度,并在html中内联

我的html:

<div id="map-id"
class="centerPanel"
    data-dojo-type="dijit.layout.ContentPane"
    data-dojo-props="region: 'center', style: 'width: 1468px;'">
</div>
我在firebug中的实际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">


正如您所看到的,我的data dojo道具样式被忽略,新的高度和宽度被插入…有什么想法吗?

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

边框容器的中心区域将被调整大小,以填充所有剩余的可用空间。如果希望中心区域具有特定的大小,则需要设置BorderContainer的样式,而不是占据中心区域的小部件。

我在dojo grid中尝试过这一点,但它也不起作用。我建议您尝试在javascript代码上执行此操作

改为在容器对象中添加具有宽度和高度属性的样式对象

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

我认为声明式方式不起作用。

听起来您的ContentPane好像在BorderContainer中,在这种情况下,很可能是父布局小部件(BorderContainer)在指定子ContentPane的大小。也许提供一个更完整的例子来说明你想做什么,会给我们更多的帮助。
myGrid = new DataGrid({
    store: myObjectStore,
    structure : myStructure,
    style: {
        width: '1000px', 
        height: '500px', 
    },
}, "myGrid");