- 我有一個帶初始標題列寬的聲明性dojox.grid.datagrid。我有一個文本框。我的需求是
在用戶界面中,如果用戶輸入任何值到文本框,該值應設置爲列標題的動態寬度。動態設置dojox.grid.datagrid標題列寬度
<div class="claro" id="dfgdfgd" name="dataGrid" onclick="setWidgetproperty(this.id,'xy','inner__dfgdfgd');" ondblclick="editCustomGrid(this.id)" onmouseup="setDocStyle(this.id)" style="height:200px; left:42px; position:absolute; top:89px; width:950px;"> <table class="claro" dojotype="dojox.grid.DataGrid" id="inner__dfgdfgd" rowselector="10px" style="height: 180px; width: 300px;"> <thead> <tr> <th field="Column1" id="Column1" noresize="true" width="100px"> <label id="Column1" onclick="getCustomGridColName(this.id,'inner__dfgdfgd');" style="cursor:pointer; font-family: Times; font-size:12pt;"> Column1 </label> </th> <th field="Column2" id="Column2" noresize="true" width="100px"> <label id="Column2" onclick="getCustomGridColName(this.id,'inner__dfgdfgd');" style="cursor:pointer; font-family: Times; font-size:12pt;"> Column2 </label> </th> </tr> </thead> </table> <input id="hidden__dfgdfgd" name="dataGrid" style="display:none;" type="hidden">
我可以使用下面的代碼來獲取特定列的寬度。如何將此寬度設置爲文本框值。
dojo.forEach(dijit.byId(tableID).layout.cells, function(cell,idx){
if(cell.field == id){
headerWidth = cell.width;
alert(headerWidth);
}
});
你有它嗎? :) – mschr 2013-04-05 13:03:45