I created a hide table with most of the same column names. Anytime I change this table it toggles the update property on my table. And it refreshes the data table.
if event.propertyName == 'data':
event.source.parent.getComponent('My Table').update = not event.source.parent.getComponent('My Table').update
Then on my table I added a custom property called “update” to call this code on property change.
# Create the Column Attributes Data table.
# First, let's set the defaults.
if event.propertyName == 'update':
name = ''
dateFormat = 'MMM d, yyyy h:mm a'
editable = 1
filterable = 0
hidden = 0
horizontalAlignment = '-9'
label = ''
numberFormat = '#,##0.##'
prefix = ''
sortable = 1
suffix = ''
treatAsBoolean = 0
verticalAlignment = 0
wrapText = 0
# Now let's get rows loaded in the table.
rows = []
hidetable = event.source.parent.getComponent('Hide Table').data
mytable = event.source.data
#See if I should hide this column.
for name in mytable.columnNames:
#See if column name exists
try:
hide = hidetable.getValueAt(0,name)
newrow = [name, dateFormat, editable, filterable, hide, horizontalAlignment, label, numberFormat, prefix, sortable, suffix, treatAsBoolean, verticalAlignment, wrapText]
rows.append(newrow)
#Ok, I can't find that column name.
except:
newrow = [name, dateFormat, editable, filterable, hidden, horizontalAlignment, label, numberFormat, prefix, sortable, suffix, treatAsBoolean, verticalAlignment, wrapText]
rows.append(newrow)
# Build the header
headers = ["name", "dateFormat", "editable", "filterable", "hidden", "horizontalAlignment", "label", "numberFormat", "prefix", "sortable", "suffix", "treatAsBoolean", "verticalAlignment", "wrapText"]
data = system.dataset.toDataSet(headers, rows)
event.source.columnAttributesData = data
I used power tables and Ignition 7.7.2.
I am attaching the window I did to test for you.
Cheers,
Chris
Table Attribrutechange.proj (24.6 KB)