TRUECHART Knowledge Base Live Search

Search

Page tree

trueChart Help

Skip to end of metadata
Go to start of metadata

Here you can read how to use button+ custom actions to implement your own selection based navigation

Step-by-step guide

  1. You must have at least one field in your app which represents sheet ids (SheetID) and an optional field which represents sheet descriptions (SheetDescription)

  2. Define a Cell Action or menubar button with action, which you have on every sheet (an image button with a logo for example)

  3. Create an onLoad trigger with following custom action
    On Load trigger
    // "onLoad" trigger
    var nameSpace = 'YourCustomNameSpace',  // define your own custom name space (global variable)
        idFieldName = 'SheetID',            // define the name of your sheet id field
        descFieldName = 'SheetDescription'; // define the name of your sheet description field
    
    
    var customNS = window[nameSpace];
    if(!customNS){
       customNS = window[nameSpace] = {};
    
       // get fields
       var app = qlik.currApp();
       customNS.idField = app.field(idFieldName);
       customNS.descField = app.field(descFieldName);
    
       // load data
       customNS.idField.getData();
       customNS.descField.getData();
    
       // bind event listener on description field
       customNS.descField.OnData.bind(function(){
          var currSheetId = qlik.navigation.getCurrentSheetId().sheetId;
          currSheetId && this.rows.some(function(descRow){
             if(descRow.qState === 'S'){
                customNS.idField.rows.some(function(idRow){
                   if(descRow.qElemNumber === idRow.qElemNumber && idRow.qText !== currSheetId){
                      customNS.navigate = true;
                      qlik.navigation.gotoSheet(idRow.qText);
                      return true;
                   }
                });
             }
          });
       });
    }
  4. Create a beforeNavigation trigger with following custom action

    Befor navigation trigger
    // "beforeNavigation" trigger
    var customNS = window['YourCustomNameSpace'];
    
    var currSheetId = qlik.navigation.getCurrentSheetId().sheetId;
    currSheetId && customNS.idField.rows.some(function(row){
       if(row.qText === currSheetId){
          if(!customNS.navigate){
             customNS.descField.select([row.qElemNumber], false).catch(function(err){console.error(err);});
          }
          customNS.navigate = false;
          return true;
       }
    });
  5. Now (save and reload the page) you should be able to navigate by selecting SheetDescription field