Javascript dojox数据网格未显示
我有一个用html标记声明的contentPane/tabContainer。第三个选项卡包含一个dojox.grid.DataGrid,默认情况下是隐藏的 在findTask.execute之后,数据存储被设置,dojox.grid.DataGrid被填充,但是我无法让它显示出来 下面是一个JSFIDLE: 在html标记的底部,如果删除“searchStatus”div并重新运行JSFIDLE,结果会显示良好 有什么建议吗Javascript dojox数据网格未显示,javascript,dojo,Javascript,Dojo,我有一个用html标记声明的contentPane/tabContainer。第三个选项卡包含一个dojox.grid.DataGrid,默认情况下是隐藏的 在findTask.execute之后,数据存储被设置,dojox.grid.DataGrid被填充,但是我无法让它显示出来 下面是一个JSFIDLE: 在html标记的底部,如果删除“searchStatus”div并重新运行JSFIDLE,结果会显示良好 有什么建议吗 谢谢 原因是,ContentPane布局容器会评估是有一个子级还是
谢谢 原因是,ContentPane布局容器会评估是有一个子级还是多个子级。它以不同的方式处理大小调整,并将知道'isSingleChild'和child==小部件。如果它重新识别一个小部件,它将调用其resize函数 要实现这一点,您需要手动调用resize-使用容纳网格的
ContentPane
的维度。这里有一种方法,通过标记
<div id="searchCol" dojoType="dijit.layout.ContentPane" title="Find Results">
<script event="onShow" type="dojo/connect">
// onShow connect is 1 ms too early to connect, adding 'whenIdle'
setTimeout(function() {
dijit.byId('grid').resize(
dojo.getMarginBox('searchCol')
);
},1);
</script>
<!--REMOVE the searchStatus element and the dataGrid displays? -->
<div id="searchStatus"></div>
<!--REMOVE the searchStatus element and the dataGrid displays? -->
<table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">
<thead>
<tr>
<th field="PARCELID">Parcel ID</th>
<th field="OWNERNME1" >Owner 1</th>
<th field="OWNERNME2">Owner 2</th>
<th field="RESYRBLT ">Year Built</th>
<th field="SITEADDRESS" width="100%">Address</th>
</tr>
</thead>
</table>
<button id="clearSearch" dojoType="dijit.form.Button" type="button" onclick="clearSearchResults()" title="Clear Search Results" label="Clear Results"
iconClass="clearSearchBtn" style="position:absolute; bottom:7px;cursor:pointer; visibility:hidden"></button>
</div>
var size = dojo.getMarginBox('searchCol');
size.h = size.h
- dojo.getMarginBox(dojo.byId('searchStatus')).h
- dojo.getMarginBox(dojo.byId('clearSearch')).h;
dijit.byId('grid').resize(size);