Rows delete table

I have a table, when I click on a button it takes the “tableindex” and the “rowdata”. I want, when I click on index 0 it delete this row of the table, and insert into the database and push into a table.
export function tablePerfilSistema_rowSelect(event, $w) {

let rowData = event.rowData;    // {"fName": "John", "lName": "Doe"} 
let rowIndex = event.rowIndex;  // 2 
console.log(rowIndex); 
console.log(rowData); 
$w("#txtwowData").text = rowData.itens; 

}
export function ir_click(event, $w) {
let id = $w(“#textid”).text;
let rowdata = $w(“#txtwowData”).text;

let rows = $w("#tablePerfilUsuario").rows; 
rows.push({ itens: rowdata }); 
$w("#tablePerfilUsuario").rows = rows; 
insert_ir(); 

}
function insert_ir() {
let id = $w(“#textid”).text;
let rowdata = $w(“#txtwowData”).text;
let toInsert = {
“idMembro”: id,
“permissaoNome”: rowdata,

}; 
wixData.insert("MembroPermissao", toInsert) 
    .then((results) => { 
        let item = results; //see item below 
    wixLocation.to("https://laudoimagem.wixsite.com/teste/membros"); 
    }); 

}
How do I delete the zero line from the first table and pass the values ​​to the second table