# Build queryBrutal part dynamically from assetData and descriptions
queryBrutal = ", ".join(["Asset.{} AS \"{}\"".format(field, field) for field in descrips])
and {queryBrutal} in the query
I´m getting more data but the table doesn´t show more columns.
I would like to know how to add columns while I adding data dinamicaly?
this is how I tried to update the table component, but gives a component error in the table
table_component = self.parent.getChild("TabContainer").getChild("TablaInventario")
if table_component is not None:
table_component.props.data = dataset
# Manually update the columns property based on the dataset
column_headers = dataset.getColumnNames()
new_columns = []
for header in column_headers:
# Create column configurations for each new column
new_columns.append({"field": header, "header": header})
# Set the columns property to the new columns
table_component.props.columns = new_columns
Bind the columns property to your dataset then build the column configuration from this.
A dataset even contains data type information so you can configure the columns accordingly.
But frankly I'd approach the whole thing differently.
Query the whole table, configure the columns however you want, then switch each column's visible property based on whatever you use to select columns in your UI.
This avoids the need to rebuild your query dynamically, and also the need to re-query your db every time the user decides he wants to hide or show a column.