TRUECHART Knowledge Base Live Search

Search

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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


    Code Block
    languagejs
    titleOn Load trigger
    linenumberstrue
    // "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

    Code Block
    languagejs
    titleBefor navigation trigger
    linenumberstrue
    // "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



Content by Label
showLabelsfalse
max5
spacestckb
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("action","navigation","selection","custom") and type = "page" and space = "tckb"
labelsAction Custom Selection Navigation

...