复选框用于手动接触的自定义渲染不起作用

Checkbox custom render for handsontable not working

本文关键字:自定义 不起作用 接触 用于 复选框      更新时间:2023-09-26

我已经为handontable中的复选框应用了自定义渲染器。我的手持表的所有行和列中都只有复选框。只读属性将应用于手触式设置中指定的行,但当我第一次单击任何复选框时,它会提示我取消选中它。单击一次,它将使其成为只读

function readonly(instance, td, row, col, prop, value, cellProperties) {
    Handsontable.CheckboxCell.renderer.apply(this, arguments);
    cellProperties.readOnly = true;
    td.style.background = '#ECECF2';

    var settings1 = {
            data:$scope.secondGridData,
            stretchH: 'false',
            fillHandle: false,
            colWidths: [85,120, 63, 63, 63,63, 63,63, 63,63, 63, 63, 63,63],
            comments: true,

                             contextMenu: false,
                             className: "htCenter",
                             cells: function (row, col, prop) {
                                  var cellProperties = {};
                                  if((row>=1())){
                                      cellProperties.renderer = readonly;
                                  } 
 return cellProperties;
}

首先,您的设置似乎是在渲染器中定义的,所以可能不要这样做。并且应该返回td,这就是渲染器不工作的原因。解决这两件事,它应该会起作用。