|
<< Click to Display Table of Contents >> Navigation: Telegram > 2024 > 08 > 27 > Telegram_2024-08-27T09 |
2024-08-27T09:30:44
that´s correct... the usual solution is adding controls to each row and map the OnClick/OnAsync click for each row.
Ex:
type: pre procedure TfrmListadoDatosFacturacion.grdListadoRenderCell(ACell: TIWGridCell; const ARow, AColumn: Integer);
...
if (ARow > 0) and (AColumn = 7) then
begin
ACell.Text := '';
ACell.Control := TIWButton.Create(grdListado);
TIWButton(ACell.Control).Caption := 'Deletar';
TIWButton(ACell.Control).CSS := 'btn btn-primary';
TIWButton(ACell.Control).Image.WebFontClass := 'fas fa-trash';
TIWButton(ACell.Control).OnAsyncClick := DeletaRegistroAsyncClick;
TIWButton(ACell.Control).OnHTMLTag := HTMLTagEventForConfirmation;
TIWButton(ACell.Control).Name := 'DELETE_BTN' + RandomString(10);
// guardamos el ID en la propriedad Tag para poder deletar el registro
TIWButton(ACell.Control).Tag := DataSource.DataSet.FieldByName('id').AsInteger;
end; language:
type: pre procedure TfrmListadoDatosFacturacion.DeletaRegistroAsyncClick(Sender: TObject; EventParams: TStringList);
const
cMensage = 'Deletar los Datos para Facturacion de \%s\?';
var
lRS: string;
begin
fID := TIWControl(Sender).Tag;
DataSource.DataSet.Locate('id', fID, []);
lRS := DataSource.DataSet.FieldByName('razon_social').AsString;
fFrameConfirmaOperacion.Mensage := Format(cMensage, [lRS]);
fFrameConfirmaOperacion.Show;
end; language: