Thank you very much @cmallonee for your valuable time and response.
I am able to get the cell color with this script without any problem; however, my problem is with the edit cell command. So I have a simple script on “onEditCellCommit”:
rowIndex=event.row # row number of the commit
colName=event.column # column name of the commit
newValue=event.value
data = self.props.data # Dataset [86R ? 8C]
newData = system.dataset.setValue(data, rowIndex,colName,newValue)
self.view.custom.part.spec.data = newData
I am able to edit my cells with the script above without any problem but as soon as I apply the cell color to that script, I get this error:
setValue(): 1st arg can’t be coerced to com.inductiveautomation.ignition.common.Dataset
output_json=[]
style_red = {"classes": "Above"}
style_green = {"classes": "Between"}
style_yellow = {"classes": "Below"}
for row in range(value.getRowCount()):
row_object = {}
for col in value.getColumnNames():
cell_object={}
cell_style={}
cell_object['value']=value.getValueAt(row,col)
if col == 'process_value':
if value.getValueAt(row,col)>=value.getValueAt(row, 'low_limit') and value.getValueAt(row,col)<= value.getValueAt(row, 'high_limit'):
cell_style= style_green
elif value.getValueAt(row,col)>value.getValueAt(row, 'high_limit'):
cell_style= style_red
elif value.getValueAt(row,col)<value.getValueAt(row, 'low_limit'):
cell_style= style_yellow
cell_object['style']=cell_style
row_object[col]=cell_object
output_json.append(row_object)
return output_json
Been on this for two days now and I could not figure out what is the problem. I changed the dataset to json and tried to apply the transform script and it did not work.
I change the dataset in editcellcommit script to pydataset but that did not solve the problem either.