【问题标题】:I want to set the style properties of the cell in treegrid我想在treegrid中设置单元格的样式属性
【发布时间】:2012-02-20 07:35:21
【问题描述】:

这是我的代码

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”的“左边”

【问题讨论】:

    标签: jquery jqgrid jqgrid-php jqgrid-formatter


    【解决方案1】:

    首先,您对setCell 方法的第4 个参数使用了绝对错误的语法。而不是{"style='width':'18px'"},你应该使用{width: '18px'}

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

    关于更改“宽度”和“左侧”的问题的另一部分似乎是您尝试更改树节点的 级别 的错误方式。每个树网格都包含一些隐藏列(levelparentisLeafexpandedloaded),您应该将这些值与树网格的主要数据一起定义。隐藏列level 中的值定义了图标的位置:您要更改的“宽度”和“左侧”。

    查看the answeranother one 中的示例了解详情。

    【讨论】:

      猜你喜欢
      • 2015-01-15
      • 1970-01-01
      • 2010-09-25
      • 1970-01-01
      • 2017-02-01
      • 2012-05-22
      • 2018-03-01
      • 2011-10-22
      相关资源
      最近更新 更多