0 Replies Latest reply: Aug 22, 2018 4:17 PM by Luke Wileczek RSS

    Qlik Sense: Error in Navigation API. Binding to page

    Luke Wileczek

      I asked this question on stack overflow with no success: javascript - Qlik Sense: TypeError: Cannot read property 'interactionState' of null - Stack Overflow




      In Qlik Sense I took the QS Table extension and slightly modified it so that if I add a dimention that is the name of the other sheets in the app you can navigate to them by qliking the td element.

      My modifications to QS Table code:

      // added to the create rows function
      else if(~cell.qText.toLowerCase().indexOf('<sheet>')){
      var nameOfSheet = cell.qText;
      += "QSsheetName' style='cursor: pointer;'"+'>'+nameOfSheet.slice(7, nameOfSheet.length)+'</td>';

      // added a navigation function. Takes the text from the td element
      // and then uses it to find out the Sheet Id of the sheet with that
      // name and then uses the qlik.navigation api to go there.
      var app = qlik.currApp();
      function navigateToSheet ( sheetName ) {
      var allSheets = {};
      .getList('sheet', function(reply) {
      .each(reply.qAppObjectList.qItems, function(idx, value) {
      [value.qData.title] = value.qInfo.qId;
      var mySheetId = allSheets[sheetName];

      // added a listener in the Paint section to call navigation function on qlik
      .find("td.QSsheetName").on('click', function() {
      var elementText = $(this).text();


      If I click on one of the td elements in the QS table to navigate to sheet A it does navigate to sheet A, the intended sheet. However, if I leave sheet A and go to sheet B and click on anything interactive, say a point on a line chart, then I am automatically sent back to sheet A. The console doesn't always produce an error but it does report the following error sometimes:

      TypeError: Cannot read property 'interactionState' of null  
      Class.c.onPaint (client.js?1522774745642:1) 
        at client
        at a
        at p
      .$eval (require.js?1522774745642:1) 
        at p
      .$digest (require.js?1522774745642:1) 
        at p
      .$apply (require.js?1522774745642:1) 
        at o

      I added the line: console.log("table clicked")

      to my jQuery listener but it doesn't log anything after I click the table the first time. So the random navigations are cached somehow and not calling my listener function above. Can anyone help with this?