【问题标题】:How to force a column of a Handson table jquery to be noneditable?如何强制 Handsontable jquery 的列不可编辑?
【发布时间】:2013-04-25 02:12:24
【问题描述】:

我有一个 8 行和两列的表格。我只需要第二列是可编辑的。第一列应该是不可编辑的(只读)

$(document).ready(function () {

  $("#example1").handsontable({
    startRows: 8,
    startCols: 2,
    rowHeaders: false,
    colHeaders: false,
    minSpareRows: 0,
    fillHandle: true
  });

handsontable中有这样的选项吗?

【问题讨论】:

    标签: jquery handsontable


    【解决方案1】:

    Handsontable 允许您指定一个只读列:

    $(document).ready(function () {
      $("#example1").handsontable({
        data: getCarData(),
        minSpareRows: 1,
        colHeaders: ["Car", "Year", "Chassis color", "Bumper color"],
        columns: [
          {
            data: "car",
            readOnly: true
          },
          {
            data: "year"
          },
          {
            data: "chassis"
          },
          {
            data: "bumper"
          }
        ]
      });
    });
    

    更多信息,请参考handsontable docs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-20
      • 2013-03-28
      • 1970-01-01
      • 1970-01-01
      • 2013-08-23
      • 2015-05-11
      • 2023-03-16
      • 1970-01-01
      相关资源
      最近更新 更多