Can a table column editable be change at runtime?

Hi All,
Need help, I trying to minimize my work and would like to know if there is away to change a tables attribute to allow columns to be editable at runtime, just like you would through the table customizer.

Here is what I want to do,
I want to have several buttons that will:

  1. change the dataset of a table (that’s not a problem)
  2. change certain columns to editable.

ether the standard table or the power table.

Thanks

Sure, this can be done.

Which cells are editable is stored in the columnAttributesData property of a table.

You just need to modify the dataset on that property to configure which columns are editable or not. This can be done dynamically at runtime by using a Python script or a Cell Update binding.

Best,

I manage to figure out how to change the “table column editable at runtime” using the script below. Now the problem I have is the columnAttributesData does not change when the dataset is change to query a different database_table, unless the Table Customizer is open. Does anyone know how to update the columnAttributesData to reflect the new query.

objTable = event.source.parent.getComponent(‘Table’).columnAttributesData
rows=event.source.parent.getComponent(‘Table’).data.columnCount

#Set Table Columns Editable
for i in range(rows):
if i > 0:
objTable = system.dataset.setValue(objTable,i,“Editable”, True)
event.source.parent.getComponent(‘Table’).columnAttributesData = objTable

#Set Table Columns not Sortable
for i in range(rows):
objTable = system.dataset.setValue(objTable,i,“Sortable”, False)
event.source.parent.getComponent(‘Table’).columnAttributesData = objTable

2 Likes