Dashboards & Visualizations

Update TableView results with external data

Motivator

I have a TableView containing results of a search. My problem is that I want to be able to update those results and re-render the table with data from an external source.

I am iterating through those results and making curls requests to an external ServiceNow. What I then need to do is update the status and ticket id of the external call to the original TableView result set.

The code is

    var searchResultsRows = searchResults.data().rows;
    snow.startSearch();
    var snowResult = snow.data('results');
    snowResult.on('data', function() {
      if (snowResult != null) {
        var snowResults = snowResult.data().rows;
        for (var i = 0; i < snowResults.length; i++) {
          searchResultsRows[i][OFFSET_STATUS] = snowResults[i][3];
          searchResultsRows[i][OFFSET_TICKET] = snowResults[i][5];
        }
        detailTable.render();
      }
    });

where detailTable is the original TableView and searchResultsRows is the set of results from that search.

Having debugged the JS render() function in the browser, I can see that there are two problems

  • The searchResultsRows I am updating is not actually the raw data in the table.
  • There appears to be a flag this.isRendered, which appears to be preventing the update, as I have a custom cell renderer that is not being called.

Questions is - anyone know how this is possible, i.e. to force a re-render, and secondly to update the data in the original table.

0 Karma

Motivator

I have managed to get the second part of the problem solved, but just including a new eval statement with a token, which I just update with a new token value (that is not shown in the table) and that causes the table to redraw, but I still am not able to update the data itself.

0 Karma