سؤال

here is my code

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

and when i select the cell from firebug the cell looks like this:

<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>

i want to change the "width" of first "div" and "left" of second "div"

هل كانت مفيدة؟

المحلول

First of all you use absolutely wrong syntax for the 4-th parameter of setCell method. Instead of {"style='width':'18px'"} you should use {width: '18px'}:

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

The other part of your question about changing of the "width" and "left" seems be the wrong way how you try to change the level of the tree node. Every tree grid contains some hidden columns (level, parent, isLeaf, expanded, loaded) which values you should define together with the main data of the tree grid. The value from the hidden column level defines the position of the icon: the the "width" and "left" which you want to change.

Look at example from the answer or another one for details.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top