2012-02-20 32 views
0

這裏是我的代碼我想設置的TreeGrid單元格的樣式屬性

jQuery("#tree").setCell (i,3,'',{"style='width':'18px'"}); 

,當我從螢火蟲選擇小區的小區看起來是這樣的:

<td aria-describedby="tree_name" title="task5" style="" role="gridcell"> 
    <div class="tree-wrap tree-wrap-ltr" style="width: 50px;"> 
    <div class="ui-icon ui-icon-radio-off tree-leaf treeclick" style="left: 36px;"></div> 
    </div> 
    <span class="cell-wrapperleaf">task5</span> 
    </td> 

我想更改第二個「div」的第一個「div」和「left」的「寬度」

回答

0

首先,您對setCell方法的第4個參數使用絕對錯誤的語法。取而代之的{"style='width':'18px'"}你應該使用{width: '18px'}

$("#tree").jqGrid('setCell', i, 3, '', {width: '18px'}); 

你對「寬度」和「左」的改變問題的其他部分似乎是走錯了路,你如何試圖改變樹節點的水平。每棵樹網格都包含一些隱藏列(level,parent,isLeaf,expanded,loaded),您應該將這些值與樹網格的主要數據一起定義。來自隱藏列level的值定義了圖標的位置:要更改的「寬度」和「左側」。

查看來自the answeranother one的示例以瞭解詳細信息。