Grid

TsgcHTMLComponent_Grid — una griglia dati HTML ricca di funzionalità con ordinamento, filtro, esportazione CSV/PDF, modifica inline, raggruppamento, scroll virtuale e query IA, in Delphi, C++ Builder e .NET.

TsgcHTMLComponent_Grid

Definisci le Columns, inserisci le righe (oppure collega un dataset), attiva le funzionalità interattive che desideri, quindi leggi la proprietà HTML.

Classe del componente

TsgcHTMLComponent_Grid

Renderizza

Bootstrap 5 <table> + interactive script

Famiglia

Dati e Tabelle

Linguaggi

Delphi, C++ Builder, .NET

Definisci le colonne, aggiungi le righe, renderizzalo

Aggiungi una voce Columns.Add per ogni campo, inserisci le righe con AddRow, abilita ShowSort/ShowFilter/ShowExport, quindi leggi HTML.

uses
  sgcHTML_Component_Grid;

var
  oGrid: TsgcHTMLComponent_Grid;
begin
  oGrid := TsgcHTMLComponent_Grid.Create(nil);
  try
    oGrid.TableID := 'orders';
    oGrid.Striped := True;
    oGrid.Hover := True;
    oGrid.ShowSort := True;
    oGrid.ShowFilter := True;
    oGrid.ShowExport := True;

    oGrid.Columns.Add.Title := 'Customer';
    oGrid.Columns.Add.Title := 'Country';
    oGrid.Columns.Add.Title := 'Total';

    oGrid.AddRow(['Alfreds', 'Germany', '1,200']);
    oGrid.AddRow(['Around the Horn', 'UK', '1,900']);

    WebModule.Response := oGrid.HTML;   // Bootstrap table + script
  finally
    oGrid.Free;
  end;
end;

// Or bind it straight to a dataset:
oGrid.LoadFromDataSet(qryOrders);
// includes: sgcHTML_Component_Grid.hpp

TsgcHTMLComponent_Grid *oGrid = new TsgcHTMLComponent_Grid(NULL);
try
{
  oGrid->TableID = "orders";
  oGrid->Striped = true;
  oGrid->Hover = true;
  oGrid->ShowSort = true;
  oGrid->ShowFilter = true;
  oGrid->ShowExport = true;

  oGrid->Columns->Add()->Title = "Customer";
  oGrid->Columns->Add()->Title = "Country";
  oGrid->Columns->Add()->Title = "Total";

  oGrid->AddRow(OPENARRAY(String, ("Alfreds", "Germany", "1,200")));
  oGrid->AddRow(OPENARRAY(String, ("Around the Horn", "UK", "1,900")));

  String html = oGrid->HTML;   // Bootstrap table + script
}
__finally
{
  delete oGrid;
}
using esegece.sgcWebSockets;

var grid = new TsgcHTMLComponent_Grid();
grid.TableID = "orders";
grid.Striped = true;
grid.Hover = true;
grid.ShowSort = true;
grid.ShowFilter = true;
grid.ShowExport = true;

grid.Columns.Add().Title = "Customer";
grid.Columns.Add().Title = "Country";
grid.Columns.Add().Title = "Total";

grid.AddRow(new string[] { "Alfreds", "Germany", "1,200" });
grid.AddRow(new string[] { "Around the Horn", "UK", "1,900" });

string html = grid.HTML;   // Bootstrap table + script

Proprietà e metodi principali

I membri che utilizzerai più spesso.

Colonne e righe

Columns (ogni elemento ha Title, Name, Width, Align); AddRow(values) aggiunge una riga; Rows espone la lista di supporto delimitata da tabulazioni; Clear la svuota.

Binding ai dataset

LoadFromDataSet ha tre overload — tutti i campi, un elenco di campi nominati, o un limite massimo di righe — e DataSource guida l’aggiornamento live.

Stile

Striped, Bordered, Hover, Responsive, Dark e CSSClass corrispondono alle classi delle tabelle Bootstrap.

Interattività

ShowSort, ShowFilter, ShowExport (CSV + PDF), InlineEdit con EditMode e ColumnReorder aggiungono comportamento lato client.

Raggruppamento e scorrimento

ShowGrouping + GroupByColumn renderizzano le intestazioni di gruppo; VirtualScroll con VisibleRows e VirtualScrollURL carica altre righe man mano che vengono mostrate.

Query IA

AIQueryEnabled aggiunge una barra di richiesta (AIQueryPlaceholder, AIQueryButtonText, AIQueryButtonStyle); ProcessAIQuery attiva l’evento OnAIQuery.

Continua a esplorare

Tutti i componenti sgcHTMLEsplora la matrice completa delle funzionalità di oltre 60 componenti.
Scarica la Prova GratuitaLa prova di 30 giorni include i progetti demo 60.HTML.
PrezziLicenze Single, Team e Site con codice sorgente completo.

Pronto a Iniziare?

Scarica la versione di prova gratuita e inizia a creare interfacce web in Delphi, C++ Builder e .NET.