Skip to content

CheckColumn

Show the checkbox.

To make it editable, please use CheckEditor.

Style Properties

PropertyDescriptionDefault
checkBgColorDefine background color of checkbox, when it is checked.Resolve by the theme.
uncheckBgColorDefine background color of checkbox, when it is unchecked.Resolve by the theme.
borderColorDefine border color of checkbox.Resolve by the theme.
textAlignDefine horizontal position of checkbox in cell.'center'
textBaselineDefine vertical position of checkbox in cell.--
bgColorDefine background color of cell.Resolve by the theme.
html
<div class="sample1 demo-grid small"></div>
js
const grid = new cheetahGrid.ListGrid({
  parentElement: document.querySelector(".sample1"),
  header: [
    {
      field: "c1",
      caption: "check",
      width: 100,
      columnType: "check", // or `new cheetahGrid.columns.type.CheckColumn()`
    },
    {
      field: "c2",
      caption: "style",
      width: 100,
      columnType: "check",
      style: {
        uncheckBgColor: "#FDD",
        checkBgColor: "rgb(255, 73, 72)",
        borderColor: "red",
      },
    },
    {
      caption: "show",
      width: 100,
      columnType: new cheetahGrid.columns.type.ButtonColumn({
        caption: "SHOW",
      }),
      action: new cheetahGrid.columns.action.ButtonAction({
        action(rec) {
          alert(JSON.stringify(rec, null, "  "));
        },
      }),
    },
  ],
});
grid.records = [
  { c1: true, c2: false },
  { c1: false, c2: true },
  { c1: true, c2: false },
  { c1: false, c2: true },
  { c1: true, c2: false },
  { c1: false, c2: true },
  { c1: true, c2: false },
  { c1: false, c2: true },
  { c1: true, c2: false },
  { c1: false, c2: true },
];