Tôi có cùng một loại vấn đề. Tôi đã thử một giải pháp tương tự như của Ryan Corradini.
Chỉ hiển thị cho lần hiển thị đầu tiên. Nếu tôi thay đổi kích thước cửa sổ, chức năng thay đổi kích thước được gọi chính xác, nhưng kích thước của lưới vẫn không thay đổi.
Xin lưu ý các điều kiện cụ thể của tôi: trong chức năng thay đổi kích thước, tôi phải đặt thuộc tính chiều cao của lưới (chỉ thay đổi kích thước + cập nhật dường như không đủ).
HTML trông giống như:
<div id="msgItems" dojoType="dijit.layout.ContentPane" region="center"
style="padding:2px;">
<form id="msgDefForm" name="msgDefForm" dojoType="dijit.form.Form">
<div style="display:none;"><input type="text" name="msgName" id="msgName" dojoType="dijit.form.TextBox"></input>
</div>
<table dojoType="dojox.grid.DataGrid" jsId="msgGrid" id="msgGrid"
rowsPerPage="10" rowSelector="5px" singleClickEdit="false" loadingMessage="Loading message content"
errorMessage="Error while loading the message content" selectable="true" >
<thead>
<tr>
<th field="zone" width="8em" cellType="dojox.grid.cells.Select" options="properties, values" editable="true">Zone</th>
<th field="property" width="auto" editable="true">Property</th>
<th field="value" width="auto" editable="true">Value</th>
</tr>
</thead>
</table>
</form>
</div>
JS trông giống như:
... in startOnLoad :
dojo.connect(window, "onresize", msgGridResized);
msgGridResized();
...
function msgGridResized() {
var cont = dojo.byId("msgItems")
var h = cont.clientHeight - 4;
if (h >= 0){
var grd = dijit.byId("msgGrid");
grd.attr("height", h+"px");
grd.resize();
grd.update();
}
}
OK! Tôi tìm thấy nó: thẻ "form" dường như can thiệp vào tính toán bố cục. Tôi chỉ đơn giản là lấy nó ra, và thay đổi mã của tôi cho phù hợp để không cần trường nhập ẩn và nó bây giờ là OK. – user140140