This method allows the application user to add a new empty row(s) below or above the current selection in a table and is implemented as a button event listener.
xxxxxxxxxx
create_row(): void {
Set the page in edit mode allowing one to make the changes and manipulate the row.
xxxxxxxxxx
this.edit_click();
Get the selected table-row(tr).
xxxxxxxxxx
const tr_selected = this.theme.target!.querySelector(".TR");
Afterwards create a new table-row(tr) element below the selected one if there is any selected.(Get the table body.)
xxxxxxxxxx
const tbody = this.theme.target!.querySelector("tbody")!;
Get the row index of the selected row to append to, else if no row is selected, append to the first row.
xxxxxxxxxx
const rowIndex = tr_selected === null
? 0
: (<HTMLTableRowElement> tr_selected).rowIndex;
Insert the new empty row into the table body.
xxxxxxxxxx
const tr = tbody.insertRow(rowIndex);
Then create a new table-row(tr) with no data into the table.
xxxxxxxxxx
this.theme.load_tr_element(tr);
}