Thanks all for the comments.
Here's the working solution.
- setup a time picker component.
- configure these parameters.
column,columnIndex,row,rowIndexandvalue, 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
valueis bound to theview.params.value.
thechange scriptof thevaluebinding is:
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.
def onMessageReceived(self, payload):
value = payload['value']
rowIndex = int(payload['rowIndex'])
tag_name = str(payload['tag_name'])
tagPath = "[default]Site_Control/ds_csp_1"
dataset = system.tag.readBlocking(tagPath)[0].value
system.tag.write(tagPath, system.dataset.setValue(dataset, rowIndex, tag_name, value))
In summary, the basic data flow is:
- operator change time picker value.
- the following values are sent from the table component to the embedded time picker component.
column,columnIndex,row,rowIndexandvalue - the time picker component detects the value change, then it executes the message script.
- the table received the message handler, it executes the logic to write to the table binding tag
- the updated tag is bound to the table, then the table is refreshed with the new value.


