Dynamic Column Editable

Is there a way to do the following in a power table:
if Column A (Boolean) is checked turn off editable in Column B.

If you go into the scripting for the power table you should be able to use the isCellEditable function to determine if an individual cell can be edited. You would just have to do a check on your dataset for the boolean in the same row.

I am very new to Ignition. Can you provide me with an example?

Take a look at this thread, and post back here if you have any questions.

Oh, and welcome to the forums! :slight_smile:

I think I am close but I still can’t get this to work. Here is what I have in the onCellEdited on my power table:

data = self.data if colName == "LeakFound":
	if data.getValueAt(rowIndex,"NoLeakFound")==1:
		return False
		return True
elif colName == "NoLeakFound":
	return False
	return True

value = newValue
value = str(value)
table = self.data
dataset = self.name
pythonDataset = system.dataset.toPyDataSet(table)
id =  pythonDataset[rowIndex][0]
query = "UPDATE AirLeak SET " + str(colName) + "  = ?"
query = query + " WHERE id = ? "
values = [value, id]
system.db.runPrepUpdate(query, values)
system.db.refresh(self, 'data')

What are you trying to do with the return False and return True in the onCellEdited? I’m assuming that part of it should be in the isCellEditable. Also what your doing with value can be done in one line. Same with query

value = str(newValue)

query = "UPDATE AirLeak SET " + str(colName) + "  = ? WHERE id = ? "

Also what errors are you getting? The error messages in your log will give you a good idea where to look in your script.

I am not getting an error in the console. When I click on a cell nothing happens. The cell should go from uncheck to checked and it is not. And with no changes being made it does not update my SQL table. I am trying to make it so when the column NoLeakFound is check I can not edit the LeakFound column.

Put the first part of code in the isCellEditable extension function.

data = self.data 
if  data.getValueAt(rowIndex,"NoLeakFound") == 0: 
	if colName == "LeakFound"
                 return True
	return False

Then put the query part in the onCellEdited extension function

ndx = self.data.getValueAt(rowIndex,0)
system.db.runPrepUpdate("UPDATE AirLeak SET %s=? WHERE AirLeak_ndx=?"%colName, [newValue,ndx])

I made the changes you recommended. I get the process to work. Thank you ALL for your knowledge and willingness to help. :slight_smile: