Table cell change to date and time picker

Thanks all for the comments.

Here's the working solution.

  1. setup a time picker component.
  2. configure these parameters.

    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.
  3. the time picker value is bound to the view.params.value.

    the change script of the value binding 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:

  1. operator change time picker value.
  2. the following values are sent from the table component to the embedded time picker component.
    column, columnIndex, row, rowIndex and value
  3. the time picker component detects the value change, then it executes the message script.
  4. the table received the message handler, it executes the logic to write to the table binding tag
  5. the updated tag is bound to the table, then the table is refreshed with the new value.