La grilla tiene que tener las columnas que estamos enviando a insertar:
const tabla = BizuitForm.controls['grdTable_01'];
const rows = await tabla.value;
rows.push({
CompanyName: 'TEST',
ContactTitle: 'TEST',
CustomerId: 'TEST',
});
tabla.value = {
pages: {},
rows: rows
};
Para editar un registro seleccionado:
var selectedRows = await BizuitForm.controls['grdTable_01'].selected;
if (selectedRows && selectedRows.length) {
const selectedRow = selectedRows[0];
var allRows = await BizuitForm.controls['grdTable_01'].allRows;
const index = allRows.findIndex(x => x.CustomerId === selectedRow.CustomerId);
if (index > -1) {
allRows[index]['CompanyName'] = 'NUEVO NOMBRE';
BizuitForm.controls['grdTable_01'].value = {
pages: {},
rows: allRows
};
}
}
Para eliminar un registro seleccionado:
var selectedRows = await BizuitForm.controls['grdTable_01'].selected;
if (selectedRows && selectedRows.length) {
const selectedRow = selectedRows[0];
var allRows = await BizuitForm.controls['grdTable_01'].allRows;
const index = allRows.findIndex(x => x.CustomerId === selectedRow.CustomerId);
if (index > -1) {
allRows.splice(index, 1);
BizuitForm.controls['grdTable_01'].value = {
pages: {},
rows: allRows
};
}
}