DataTable
TsgcHTMLComponent_DataTable — 一个更高级的数据表,将 Grid 和 Pagination 封装在卡片中,带有搜索工具栏、每页条数选择器、导出按钮和行数统计,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_DataTable — 一个更高级的数据表,将 Grid 和 Pagination 封装在卡片中,带有搜索工具栏、每页条数选择器、导出按钮和行数统计,适用于 Delphi、C++ Builder 和 .NET。
绑定数据集,设置每页条数和工具栏选项,然后读取 HTML 属性 — 如果需要更精细的控制,会公开内部的 Grid 和 Pagination。
TsgcHTMLComponent_DataTable
带有工具栏、<table> + 分页的 Bootstrap 5 卡片
Delphi, C++ Builder, .NET
设置 Title 和工具栏标志,用每页条数调用 LoadFromDataSet,然后读取 HTML。访问内部的 Grid 可调整列。
uses
sgcHTML_Component_DataTable;
var
oTable: TsgcHTMLComponent_DataTable;
begin
oTable := TsgcHTMLComponent_DataTable.Create(nil);
try
oTable.Title := 'Customers';
oTable.ShowSearch := True;
oTable.ShowExport := True;
oTable.ShowRowCount := True;
oTable.SearchPlaceholder := 'Search customers...';
oTable.Grid.Striped := True;
oTable.LoadFromDataSet(qryCustomers, 25);
WebModule.Response := oTable.HTML; // card + table + pagination
finally
oTable.Free;
end;
end;
// includes: sgcHTML_Component_DataTable.hpp
TsgcHTMLComponent_DataTable *oTable = new TsgcHTMLComponent_DataTable(NULL);
try
{
oTable->Title = "Customers";
oTable->ShowSearch = true;
oTable->ShowExport = true;
oTable->ShowRowCount = true;
oTable->SearchPlaceholder = "Search customers...";
oTable->Grid->Striped = true;
oTable->LoadFromDataSet(qryCustomers, 25);
String html = oTable->HTML; // card + table + pagination
}
__finally
{
delete oTable;
}
using esegece.sgcWebSockets;
var table = new TsgcHTMLComponent_DataTable();
table.Title = "Customers";
table.ShowSearch = true;
table.ShowExport = true;
table.ShowRowCount = true;
table.SearchPlaceholder = "Search customers...";
table.Grid.Striped = true;
table.LoadFromDataSet(qryCustomers, 25);
string html = table.HTML; // card + table + pagination
您最常使用的成员。
LoadFromDataSet(aDataSet, aPageSize) 填充内部网格并根据记录数设置分页;DataSource 驱动实时刷新。
ShowSearch 配合 SearchPlaceholder 和 SearchAction、ShowExport、ShowPageSize 配合 PageSizes,以及 Title 标题共同构成工具栏。
ShowRowCount 在卡片底部的分页控件旁打印可见行数摘要。
Grid 公开完整的 TsgcHTMLComponent_Grid — 可直接在其上设置 Striped、Bordered、列、排序/筛选等。
Pagination 公开 TsgcHTMLComponent_Pagination 实例,用于 CurrentPage、PageSize 和 TotalItems。
TableID 标识卡片和内部表格;ToolbarClass 覆盖默认的工具栏行类。