Checkboxes only on certain table rows?

I have a table and for one column I’ve selected the Boolean option and made it Editable so checkboxes appear.

However ideally I don’t want the user to be able to select any row, only ones where a certain condition is met (the value in a separate column is above a certain threshold).

I’m currently using the cellEdited event so if an “invalid” row is ticked then it immediately unticks it.

What would be ideal though is if I could only display the checkbox in the rows I want the user to be able to select, and just display a blank cell otherwise. Can this be done?

I haven’t tried it but I’m sure you could script it into the table and reference the row its in checking against your cellEdited event.

You could have a script run and check your condition and only show the right rows in your table, you could have it update too and remove ones that have been checked. Is the data coming from a DB?

George,
Have a look at this and see if it helps.

http://www.inductiveautomation.com/forum/viewtopic.php?f=70&t=11079&p=39604#p39604

My table changes the colour of the cell based on a value in a different column. The code I use is:

if col ==11 and value < self.data.getValueAt(row,12) and self.data.getValueAt(row,12) !=0: return Color.red elif col == 11 and self.data.getValueAt(row,12) !=0 : return Color.green

[quote=“drewdin”]I haven’t tried it but I’m sure you could script it into the table and reference the row its in checking against your cellEdited event.

You could have a script run and check your condition and only show the right rows in your table, you could have it update too and remove ones that have been checked. Is the data coming from a DB?[/quote]

Yes the data is from a DB. I’m already using the cellEdited so if the user ticks a box they shouldn’t be able to then it immediately unticks it (it’s instant in practice so they don’t even see the tick appear).

I do need all the rows in the table to be visible though. My ideal scenario would be to only have the checkboxes on certain rows.

Brett - thanks for your suggestion. That could indeed be used to highlight to the user which checkboxes are allowed to be used.