1 Reply Latest reply: Jun 24, 2018 7:49 PM by Elton Aguiar RSS

    VizLib advanced text object and my own extension navigate to links even in edit mode

    Elton Aguiar

      I have a KPI extension, that basically has a "go to sheet" when you click it, ... it works but also works in editor mode. I found a similar thing happening with the VIzLib advanced text object. If you add an action of a sheet, and left-click the object in edit mode it will jump to the sheet where the link points.

      I have a workaround to right-click my objects that have links , but this isn't very ideal.

       

       

      I've taken some code from an extension that is supposed to only cause a link "goto" to navigate when in analysis mode, i.e. not in "EDIT" mode based on the qlik.navigation.getMode()

          extensionUtils.addStyleToHeader(cssContent, "swr-themablekpitile");
          var layouts = JSON.parse(layoutsText);
          return {
      
         paint: function(element, layout) {
      
      
       var result = qlik.navigation.getMode();
       if(result == 'analysis'){
       console.log('ANALYSIS');
       $('.goto').click(function() {
       console.log('click');
       qlik.navigation.gotoSheet($(this).attr('id'));
                      });
       };
         },
              initialProperties: {
                  showTitles: !1
              },
      

       

      initially the link is set like this

      <a class="goto" id="{{ layout.gotosheet }}" href="javascript:;" style="text-decoration:none">
      
        • Re: VizLib advanced text object and my own extension navigate to links even in edit mode
          Elton Aguiar

          the goto function itself needs to check the qlik's navigation mode is not edit.

          otherwise what was happening is the mode isn't analysis its edit, but the buttons function is likely already set from previous paint call to navigate to the sheet.

           

          This revised code here will hopefully help prevent some annoyances and lag from having to right click on the objects instead of left-click.

           

            paint: function(element, layout) {

           

          var result = qlik.navigation.getMode();

          if(result == qlik.navigation.ANALYSIS){

           

          $('.goto').click(function() {

           

          if(qlik.navigation.getMode()!='edit'){

          qlik.navigation.gotoSheet($(this).attr('id'));

          }

                          });

          };

            },