css - Dojo data-dojo-props 样式被覆盖

标签 css openlayers dojo styling

我正在使用 dojo ContentPane 来渲染 openlayers map 。当 DOM 准备好并插入 map 时,dijit 的样式将被覆盖。我已经尝试通过类和 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>

我的 CSS:

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

我来自 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-props 样式被忽略,新的高度和宽度被插入...有什么想法吗?

最佳答案

我已经在 dojo grid 中试过了,但还是不行。我建议您尝试在 javascript 代码上执行此操作。

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

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

我认为声明方式行不通。

关于css - Dojo data-dojo-props 样式被覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9017043/

相关文章:

css - 图像不显示在 node.js 上的 jade 中

CSS 背景颜色与 IE 中表格单元格的边框重叠

jquery - 如何隐藏 nivo slider 标题区域并使幻灯片可点击

javascript - OpenLayers 没有在我的 map 上添加标记

javascript - DOJO:找到 child

javascript - 我只想在列表中显示一次重复项并删除其他项

jquery - 动态纬度/经度转换为开放层脚本

javascript - 更改开放图层中矢量要素的绘制属性

javascript - xhrpost dojo 的匿名 js 函数不返回数据

javascript - Dojo 如何混合两个数组?