Renders a feature-rich data table using the Tabulator library, with support for pivoting, grouping, pagination, column filters, and automatic column type detection.
TABULATOR — set as ReportType in def_report.
def Render(self, Param1="", Param2="", Param3="") -> str:
No parameters affect the query directly. Reads self.data_list and self.FieldNames, applies optional pivoting and date/decimal conversion, detects column types, builds Tabulator column definitions, and returns a complete HTML string including the Tabulator CSS/JS (loaded from unpkg CDN) and an optional top filter UI.
_pivot_data(data, pivot_options, precision)Pivots the dataset using pandas pivot_table based on pivot_options keys rows, cols, vals, and optional aggregatorName (Sum, Average, Count, Max, Min). Supports dynamic row ordering via rowOrder. Returns the pivoted data list and a headers mapping dict.
_detect_column_types(data, columns, sample_size=10)Samples up to sample_size rows and classifies each column as numeric, html, or string to select the appropriate Tabulator formatter.
isNumber(number)Returns True if the value can be cast to a finite float.
isHtml(Html)Returns True if the string contains parseable HTML tags.
convert_datetimes(obj)Recursively converts datetime and date objects to ISO 8601 strings for JSON serialisation.
convert_decimal_to_float(data)Converts Decimal values in the data list to float for JSON serialisation.
Options read from self._Options JSON:
| Key | Default | Effect |
|---|---|---|
columns |
{} |
Per-column overrides: label, width, hozAlign, visible, precision, bottomCalc. |
precision |
2 |
Decimal places for numeric columns. |
formatter |
"numeric" |
Tabulator formatter for numeric columns. |
layout |
"fitColumns" |
Tabulator layout mode (fitData, fitDataFill, etc.). |
groupBy |
— | Column name(s) to group rows by (string or list). |
hideGroupCount |
"FALSE" |
When "TRUE", omits the item count from group headers. |
bottomCalc |
— | Default bottom calculation type for numeric columns (sum, avg, etc.). |
pagination |
"TRUE" |
Set to "FALSE" to disable client-side pagination. |
paginationSize |
10 |
Default rows per page. |
paginationSelector |
[5,10,15,20] |
Page size dropdown options. |
topFilter |
"TRUE" |
Set to "FALSE" to hide the field/comparator/value filter row. |
dropdownFields |
— | Comma-separated column names to include in the top filter dropdown. |
filterColumns |
— | Comma-separated column names to add header filter inputs to. |
groupToggleElement |
"arrow" |
Tabulator groupToggleElement value. |
pivot_options |
{} |
Pivot config with keys rows, cols, vals, and optional aggregatorName and rowOrder. |
unpkg.com at render time."R" as the currency symbol by default in formatterParams.pandas for pivot operations; requires pandas to be installed.