【问题标题】:How to show data from cell in formatter of the same cell in slickgrid如何在 slickgrid 中的同一单元格的格式化程序中显示单元格中的数据
【发布时间】:2016-02-15 12:41:33
【问题描述】:

为了用户友好,我在 slickgrid 的列中使用了一个列表(带有输入和选择的简单 angularjs 指令)。所以用户知道有一个列表。 (从我之前的问题解决:Using formatter and editor

作为编辑,我使用了相同的列表。它现在正在工作,唯一的问题是当单元格被编辑时(从列表中选择一个项目),单元格获取项目,但它不可见,因为格式化程序在它上面。

注意:我们使用网格作为角度指令。
现在的问题是,是否也可以在格式化程序中显示单元格的值?

编辑:这就是我使用列表指令的方式:

var _preCompiledComboList = $compile('<dcs-combo-list data-enabled="true" readonly data-selected-item="value"></dcs-combo-list>')(newScope);

后来被用作:

var _cellComboListRenderer = function(row, cell, value, columnDef, dataContext){
    return _center(_preCompiledComboList[0].outerHTML);
};

渲染器函数中的值是单元格值。以及如何将列表指令的 data-selected-item 属性设置为值?

【问题讨论】:

    标签: angularjs-directive slickgrid


    【解决方案1】:

    我已经解决了这个问题。但我对解决方案不满意。

    在返回我编译的指令之前,我正在搜索第一个输入元素,并将它的值设置为单元格的“值”。

     var _cellComboListRenderer = function(row, cell, value, columnDef, dataContext){
         _preCompiledComboList[0].getElementsByTagName('input')[0].setAttribute("value", value);
         return _center(_preCompiledComboList[0].outerHTML);
     };
    

    我想要更优雅的解决方案,例如指令范围。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-13
      • 1970-01-01
      • 2012-08-15
      • 1970-01-01
      • 2017-08-03
      • 2011-02-16
      • 1970-01-01
      • 2018-01-20
      相关资源
      最近更新 更多