MCPcopy Create free account
hub / github.com/chieapp/chie / constructor

Method constructor

src/view/editable-table.ts:25–46  ·  view source on GitHub ↗
(public columns: ColumnDescriptor[])

Source from the content-addressed store, hash-verified

23 removeButton: gui.Button;
24
25 constructor(public columns: ColumnDescriptor[]) {
26 for (const column of columns)
27 this.table.addColumn(column.title);
28 this.table.setHasBorder(true);
29 this.table.setStyle({flex: 1});
30 this.table.onRowActivate = this.#editSelectedRow.bind(this);
31 this.table.onSelectionChange = () => {
32 const hasSelection = this.table.getSelectedRow() != -1;
33 this.editButton.setEnabled(hasSelection);
34 this.removeButton.setEnabled(hasSelection);
35 };
36 this.view.addChildView(this.table);
37
38 this.buttonsArea = new ButtonsArea({hideSeparator: true});
39 this.removeButton = this.buttonsArea.addButton('Remove');
40 this.removeButton.setEnabled(false);
41 this.removeButton.onClick = this.#removeSelectedRow.bind(this);
42 this.editButton = this.buttonsArea.addButton('Edit');
43 this.editButton.setEnabled(false);
44 this.editButton.onClick = this.#editSelectedRow.bind(this);
45 this.view.addChildView(this.buttonsArea.view);
46 }
47
48 setData(data: T[]) {
49 this.data = data;

Callers

nothing calls this directly

Calls 1

addButtonMethod · 0.45

Tested by

no test coverage detected