the table has been setup nicely.
But for the viewparams setup, how do I point this value to the value of this row at this column?
or do I need to write script to get the row index, then assign the value of this Value[row][column] to this param?
I have now configured to value, now I can see the different time values of each row.
Then I changed params of the value so I can read and write, but somehow I cannot change values from the table. If I change directly from the dataset, the new values can be updated to the table.
when changing the time by clicking the up/down arrow, 1 sec later, the value changed back.
do I need to setup any action trigger each time I change the value?
column, columnIndex, row, rowIndex and value, are the default params passed from the table to the component. As I have two time picker, one for start time, one for end time. so I create a new tag "tag_name" to record which time it is.
the time picker value is bound to the view.params.value.
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
value = currentValue.value
if value is not None:
if 'Binding' not in str(origin):
msg = 'UpdateRow'
rowIndex = self.view.params.rowIndex
tag_name = self.view.params.tag_name
payload = {
'value' : value,
'rowIndex': rowIndex,
'tag_name': tag_name
}
system.perspective.sendMessage(msg, payload)
once configured, whenever the time picker value is changes, it will send a message.
4. this is the table configuration of the time picker. Processing: image.png…
5. this is the message handler script of the table.
The following script converts pyDataset to dataset.
I found it handy sometimes.
def pyds_to_ds(value):
headers = system.dataset.getColumnHeaders(value)
newData=[]
for rowIndex in range(value.rowCount):
row = [value.getValueAt(rowIndex,col) for col in range(value.columnCount)]
newData.append(row)
return system.dataset.toDataSet(headers,newData)