AnsweredAssumed Answered

PI Vision force data update

Question asked by biker2000on on Jan 16, 2019
Latest reply on Jan 16, 2019 by biker2000on

I am in the process of writing a datatable symbol for PI Vision that integrates ag-grid and Anna Perry's Blog Manual data entry symbol.


The last part I am having trouble with is the data updates.


I don't want the grid to update regularly or else it deletes in progress edits. To this point, I only update the grid on sporadic/full updates.


However, I want to force an update on an edit to the grid, especially a new line edit with timestamp '*', so that it converts it to the current time.


Is there a scope.$root.$broadcast command that forces a dataUpdate?


Here is the current code for the grid initialization:


function getConfig() {
  var columnDefs = [
  {headerName: "Timestamp", field: 'time', comparator: dateComparison},
  {headerName: "sortableDate", field: 'datetime'},

  // let the grid know which columns and what data to use
  return {
  columnDefs: columnDefs,
  enableSorting: true,
  enableFilter: true,
  enableColResize: true,
  onCellValueChanged: function(event) {
  if (event.colDef.field === "time") return
  // which point/attribute was edited
  // event.colDef.headerName will return the point name or 
  console.log("Column Number: " + event.colDef.field[5] + "\n" + scope.config.DataSources[event.colDef.field[5]])
  // get the correct streamId
  let streams = getStreams(scope.config.DataSources)
  // console.log(streams)
  // console.log(scope.runtimeData.streamList)
  let time =
  let value = event.value
  if (event.newValue != event.oldValue) {
  // sendValues takes (index, time, value)
  // build data object to send to PIWebAPI
  // send data object to PIWebAPI
  sendValues(event.colDef.field[5], time, value)
  console.log("sent values " + time + "   " + value)
  // Update gridridOptions.api.setColumnDefs(event.columnApi.columnController.colDefs)