その理由は、ContentPane レイアウト コンテナーが、子が 1 つまたは複数あるかどうかを評価するためです。サイズ変更を異なる方法で処理します - 「isSingleChild」と子 == ウィジェットかどうかを認識します。ウィジェットを認識すると、そのサイズ変更関数を呼び出します。
これを行うには、 resize を手動で呼び出す必要があります-ContentPane
グリッドを格納する の寸法を使用します。マークアップによる 1 つの方法を次に示します。
<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);