Skip to content
bahtuiv0.18.8

<baht-edit-table>

A table whose cells are edited in place. A changed row shows Save (baht-row-save with { key, row }); removable adds Remove (baht-row-delete); addable adds a blank first row (baht-row-add with { row }). Feeding new rows clears the edits.

Basic

<baht-edit-table addable="true" removable="true"></baht-edit-table>

<script>
  const el = document.querySelector('baht-edit-table');
  el.columns = [
    {
      "key": "key",
      "label": "Key",
      "type": "readonly"
    },
    {
      "key": "label",
      "label": "Label"
    },
    {
      "key": "active",
      "label": "Active",
      "type": "checkbox"
    }
  ];
  el.rows = [
    {
      "id": 1,
      "key": "br-0001",
      "label": "Head Office",
      "active": true
    }
  ];
</script>
NameTypeDefaultDescription
columnsJSEditColumn[][]{ key, label, type?: 'text'|'number'|'checkbox'|'select'|'readonly', options? }
rowsJSEditRow[][]The records
row-keystring'id'
addablebooleanfalseShow the add row
removablebooleanfalseShow Remove on each row
labelstring'Table'
rowKeystring'id'Field that identifies a row