0
<script type="text/javascript">
dojo.ready(function(){
    var dataStore;
    var grid;
    dojo.xhrGet({
            url: "/mediation1.0.1/processConfig/getAll",
            handleAs: "json",
            headers:{"Accept" : "application/json"}
    }).then(function(data) {
    dataStore = new dojo.data.ObjectStore({ objectStore:new dojo.store.Memory({ data: data }) });
    grid = new dojox.grid.EnhancedGrid({
    id : "gatewayGrid",
    name : "gatewayGrid",
    store : dataStore,
    query : {id : "*"},
    plugins: {indirectSelection: true,
        pagination: {
        pageSizes: ["10", "20", "30", "All"],
        description: true,
        sizeSwitch: true,
        pageStepper: true,
        gotoButton: true,
        maxPageStep: 2,
        position: "bottom"
    }},
    selectionMode:'single',
    structure : [ 
          {name:"ID", field:"id",hidden:"true"},
          {name : "Name",           field : "name",         width : "auto"}, 
          {name : "IP Address",     field : "_item",    width : "auto",
          formatter: function(item){
              return item.collectorParams.host;
          }}
          , 
          {name : "Cron Interval",  field : "cronExpression",   width : "auto"}, 
          {name : "Status",         field : "active",   width : "auto"}
          ]
}, document.createElement('div'));
dojo.byId("cmdGateway").appendChild(grid.domNode);
grid.startup();
});  
});
</script>
<div id="switchConfigBorder" dojoType="dijit.layout.BorderContainer"
    style="background-color: white">
    <div id="switchConfigWholePane" dojoType="dojox.layout.ContentPane"
        style="background-color: white" region="top">
        <div id="cmdGateway">

        </div>
    </div>
</div>

这是从带有 href 的 dojox.layout.ContentPane 引用的页面内容。我可以在萤火虫中看到 xhrGet 请求被触发并且数据即将到来。令人惊讶的是,如果我填充选择,这种技术就会起作用。但是这个 EnhancedGrid 没有被渲染。

4

1 回答 1

1

div cmdGateway 的溢出属性是什么?它应该是自动或滚动。还可以尝试将网格的 autoHeight 属性设置为某个整数。

几天前,我在 DataGrid 上也遇到了同样的问题。我建议从设置 cmdGateway div 的高度开始,看看 Grid 是否可见。

于 2012-05-22T10:22:35.260 回答