2

I'm trying to adapt the Qooxdoo Playground table example's checkbox, to become a checkbox that can be clicked on and off.

I did see some code in a mailing list which seemed like it should do the job, but it's not working for me.

// Display a checkbox in column 3
tcm.setDataCellRenderer(3, new qx.ui.table.cellrenderer.Boolean());

table.addListener("cellClick",
  function(cellEvent) {
    var col = cellEvent.getColumn();
    if (col == 3) {
        oldValue = table.getTableModel().getValue(col, row);
        table.getTableModel().setValue(col, cellEvent.getRow(), !value);
    }
  }
);

I've put that into the Playground at https://preview.tinyurl.com/y8qubmll

My intention is to have a few different checkboxes in the columns, so the code above uses the variable "col" rather than hardcoded values.

Any help would be greatly appreciated.

Tobi Oetiker
  • 5,167
  • 2
  • 17
  • 23
pcaffin
  • 47
  • 7

1 Answers1

3

The event is called cellTap. See the fixed example below.

table.addListener("cellTap",
    function(cellEvent) {
        var col = cellEvent.getColumn();
        var row = cellEvent.getRow();
        if (col == 3) {
            oldValue = tableModel.getValue(col,row);
            tableModel.setValue(col,row, !oldValue);
        }
    }
);

here is a link to the working example

Tobi Oetiker
  • 5,167
  • 2
  • 17
  • 23