Adding dynamic columns to table seems to lose functionality

I am having a problem where adding columns to a table seems to cause the table to lose its previous functionality. Specifically, I have a table whose data is bound to an SQL Query. Inside the query I am referencing a dynamic property of the table:

SELECT name, isValid
{Root Container.Table.AdditionalFields}
FROM myTable

(Polling Mode is OFF)

In the column attributes data, I set the isValid column as a Boolean and Editable. This creates the ability to simply click on any cell in that column to add (or remove) checks in the boxes.

I have added a button to the form that updates the dynamic property:

#another field in myTable
sNF = ", myNewField"
rootWindow = system.gui.getParentWindow(event).rootContainer
tbl = rootWindow.getComponent("Table")

tbl.AdditionalFields = sNF

As expected, because an underlying property bound to the SQL Query changed, the table refreshed its data with the new column.

However, I have now lost the ability to single click in the “isValid” column to check (or uncheck) the boxes.

I think it has something to do with the column attributes data. I’m looking for any kind of workaround.

As long as you are not changing the column attributes dataset dynamically you shouldn’t lose that functionality. The isValid column should always be editable. My guess is your script to update the custom property doesn’t work when more columns are added?

Can you post a small example (export your window) here?

It must have something to do with the fact that my values are not true BIT fields and/or the way I manipulated the columns attribute data to get the values to display. I first set up the table with all possible values, then I used the Table Customizer to set the Boolean/Editable values. Later on, (after I had changed a lot of the code) I went back using the Columns Attribute Data table to manually add in a couple more rows for formatting.

Use this SQL with the attached window:

CREATE TABLE atable (isValid INT, name VARCHAR(30), myNewField INT)
INSERT INTO atable VALUES(1, 'test1', 0)
INSERT INTO atable VALUES(1, 'test2', 1)

Open the window in Design mode.
Switch to PREVIEW mode.
Verify the checkboxes are working.
Click the Add myNewField button.
NOTICE the checkboxes are not working.
adamtabletest.vwin (7.15 KB)

Like you said, it has to do with the fact that your data type of the isValid column is not a true boolean. There is a slight bug with the table that I will add a request in for. In the meantime you can get around it by doing the following:

  1. Add a custom property to the table called editable that is a boolean
  2. Set it to true
  3. Bind the column attributes dataset to a cell update binding where you link the editable cell of the isValid column to the new editable property.
  4. In the button that adds a new field toggle the editable boolean property:event.source.parent.getComponent("Table").editable = 0 .... # your code event.source.parent.getComponent("Table").editable = 1That will force it to update correctly. I have attached an example as well.adamtabletest_2013-03-26_1148.proj (9.95 KB)