Min Su Sun Posted June 5, 2023 Share Posted June 5, 2023 Please let me know if you have a python sample that hides or shows a specific column in a datatable on that page by clicking a button in a textarea. Link to comment Share on other sites More sharing options...
Fredrik Rosell Posted June 8, 2023 Share Posted June 8, 2023 Hello, I assume that what you are trying to do is to show/hide a column in a table plot (if not, please clarify). I'm not aware of any way to explicitly hide it but here are two examples where I tested first adding/removing it, and then setting the width to hide/show it. from Spotfire.Dxp.Application.Visuals import * #columnToToggle = Document.Properties["propTableColumnName"] columnToToggle = "Year" #vis is a script parameter for my table plot tablePlot = vis.As[TablePlot]() tableColumns = tablePlot.TableColumns tableDataColumns = tablePlot.Data.DataTableReference.Columns dataColumnToToggle = tableDataColumns[columnToToggle] #Check if data column exists in collection columnExists = tableColumns.Contains(dataColumnToToggle) if(columnExists): print "Exists. Remove it." tableColumns.Remove(dataColumnToToggle) else: print "Does not exist. Add it." tableColumns.Add(dataColumnToToggle) from Spotfire.Dxp.Application.Visuals import * #columnToToggle = Document.Properties["propTableColumnName"] columnToToggle = "Year" #vis is a script parameter for my table plot tablePlot = vis.As[TablePlot]() tableColumns = tablePlot.TableColumns tableDataColumns = tablePlot.Data.DataTableReference.Columns dataColumnToToggle = tableDataColumns[columnToToggle] tableColumn = tableColumns.TryGetTableColumn(dataColumnToToggle)[1] if(tableColumn.Width < 10): tableColumn.Width = 100 else tableColumn.Width = 0 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now