0

HTML マークアップで宣言された contentPane/tabContainer があります。3 番目のタブには、デフォルトで非表示になっている dojox.grid.DataGrid が含まれています。

findTask.execute の後、dataStore が設定され、dojox.grid.DataGrid が満たされますが、表示できません。

ここにjsfiddleがあります:

http://jsfiddle.net/dbecker88/BhNEa/2/

HTML マークアップの下部で、「searchStatus」div を削除して jsfiddle を再実行すると、結果が正常に表示されます。

何かアドバイス?

ありがとう!

4

1 に答える 1

1

その理由は、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);
于 2012-08-21T15:08:22.290 に答える