Grid

TsgcHTMLComponent_Grid — une grille de données HTML riche en fonctionnalités avec tri, filtre, export CSV/PDF, édition en ligne, regroupement, défilement virtuel et requête IA, en Delphi, C++ Builder et .NET.

TsgcHTMLComponent_Grid

Définissez les Columns, ajoutez des lignes (ou liez un jeu de données), activez les fonctionnalités interactives souhaitées, puis lisez la propriété HTML.

Classe du composant

TsgcHTMLComponent_Grid

Produit

<table> Bootstrap 5 + script interactif

Langages

Delphi, C++ Builder, .NET

Définissez les colonnes, ajoutez des lignes, affichez-la

Ajoutez une entrée Columns.Add par champ, ajoutez des lignes avec AddRow, activez ShowSort/ShowFilter/ShowExport, puis lisez 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

Propriétés & méthodes clés

Les membres que vous utilisez le plus souvent.

Colonnes & lignes

Columns (chaque élément possède Title, Name, Width, Align) ; AddRow(values) ajoute une ligne ; Rows expose la liste sous-jacente délimitée par tabulations ; Clear la vide.

Liaison de jeu de données

LoadFromDataSet a trois surcharges — tous les champs, une liste de champs nommés ou un plafond de lignes maximum — et DataSource pilote un rafraîchissement en direct.

Style

Striped, Bordered, Hover, Responsive, Dark et CSSClass correspondent aux classes de tableau Bootstrap.

Interactivité

ShowSort, ShowFilter, ShowExport (CSV + PDF), InlineEdit avec EditMode et ColumnReorder ajoutent un comportement côté client.

Regroupement & défilement

ShowGrouping + GroupByColumn rendent les en-têtes de groupe ; VirtualScroll avec VisibleRows et VirtualScrollURL charge davantage de lignes à l'affichage.

Requête IA

AIQueryEnabled ajoute une barre de question (AIQueryPlaceholder, AIQueryButtonText, AIQueryButtonStyle) ; ProcessAIQuery déclenche l'événement OnAIQuery.

Continuez l'exploration

Tous les composants sgcHTMLParcourez la matrice complète des fonctionnalités de plus de 60 composants.
Télécharger la version d'essai gratuiteLa version d'essai de 30 jours fournit les projets de démonstration 60.HTML.
TarifsLicences Single, Team et Site avec code source complet.

Prêt à démarrer ?

Téléchargez la version d'essai gratuite et commencez à créer des interfaces web en Delphi, C++ Builder et .NET.