ReoGrid ReoGrid Web

Interactive Checklist

Use the checkbox cell type for a tickable todo list, and derive a live progress counter from the checked rows.

Pro only. Cell types (checkbox, dropdown, etc.) are disabled in Lite.

Full example

import { createReogrid } from '@reogrid/pro';

const { worksheet } = createReogrid('#grid', { licenseKey: 'YOUR-LICENSE-KEY' });

const todos = [
  'Draft the proposal',
  'Review with design team',
  'Send to client',
  'Schedule kickoff meeting',
  'Archive previous version',
];

// Header
worksheet.cell('A1').setValue('βœ“').setStyle({ bold: true, textAlign: 'center' });
worksheet.cell('B1').setValue('Task').setStyle({ bold: true });
worksheet.cell('D1').setValue('Done:').setStyle({ bold: true, textAlign: 'right' });

// Rows: checkbox + task text
todos.forEach((task, i) => {
  const row = i + 1;
  worksheet.cell(row, 0).setType({ type: 'checkbox' }).setValue('false');
  worksheet.cell(row, 1).setValue(task);
});

// Live counter β€” COUNTIF of the ticked (TRUE) boxes in the checkbox column
worksheet.setCellInput(0, 4, `=COUNTIF(A2:A${todos.length + 1}, TRUE)&"/${todos.length}"`);

// Column sizing
worksheet.column(0).width = 40;
worksheet.column(1).width = 260;
worksheet.column(3).width = 70;
worksheet.column(4).width = 60;

// Optional: gray italic for finished rows via conditional formatting
worksheet.range(`B2:B${todos.length + 1}`).addConditionalFormat({
  type: 'expression',
  formula: '=$A2=TRUE',
  style: { color: '#9ca3af', italic: true },
});
Result
The checklist after ticking two boxes: the COUNTIF readout follows, and the conditional format grays out the finished rows.
The checklist after ticking two boxes: the COUNTIF readout follows, and the conditional format grays out the finished rows.

How the checkbox stores state

A checkbox cell stores the strings "true" / "false", and formulas read them as the logical values TRUE / FALSE, as Excel does. So compare with TRUE β€” no quotes β€” as in COUNTIF(..., TRUE) and =$A2=TRUE above.

Since v1.7.2 a comparison with the text "true" no longer matches a ticked box: =$A2="true" is FALSE, as it is in Excel. If you wrote the conditional format that way, change it to =$A2=TRUE. COUNTIF(..., "true") still counts the ticks, because a criterion compares as text. See Text and Logical Values.

To read the current state programmatically:

const isDone = worksheet.cell(1, 0).value === 'true';

To react to changes:

const off = worksheet.onCellValueChange(({ row, column, value }) => {
  if (column === 0) {
    console.log(`Row ${row} checkbox is now`, value);
  }
});
// call off() to unsubscribe

Notes

  • The checkbox cell renders natively on canvas β€” clicks are handled by the grid’s pointer controller, no DOM overlay.
  • Checkbox toggles write the value directly and bypass the action manager β€” a checkbox click is not undoable with undo/redo.
  • Conditional formatting on the text column provides the β€œgray italic when done” effect without per-cell style management.

See also

Was this page helpful?
Stay Updated

Be first to know β€” get updates as they ship

Get notified of new releases, features, and announcements.
No spam β€” just updates that matter.