2 Replies Latest reply: Feb 5, 2018 3:36 AM by Jesper Snihs RSS

    LUI Tab View set active tab

    Jesper Snihs

      I'm having an issue with the lui-tab-view component with setting which tab to be active when the application is being loaded.

       

      According to the documentation on Angular leonardo-ui components ‒ Qlik Sense Developers

      You can set a parameter, acitve-tab, on the lui-tabset, but I don't get this to work.

       

      My example looks like this:

      <lui-tab-view>
              <lui-tabset active-tab="tab2">
                  <lui-tab ref="tab1">Tab1</lui-tab>
                  <lui-tab ref="tab2">Tab2</lui-tab>
                  <lui-tab ref="tab3">Tab3</lui-tab>
              </lui-tabset>
              <lui-tab-content ref="tab1">Tab1 content</lui-tab-content>
              <lui-tab-content ref="tab2">Tab2 content</lui-tab-content>
              <lui-tab-content ref="tab3">Tab3 content</lui-tab-content>
          </lui-tab-view>
      

       

      What am I doing wrong here?

       

      Regards

      Jesper

        • Re: LUI Tab View set active tab
          Rikard Samvik

          You have two options.

          1. Declare a scope variable scope.activeTab = "tab2" and send that into the active-tab attribute: active-tab="activeTab". This way, if you change the activeTab scope variable the tabs will automatically update to the correct tab and content which could be useful later on.

          2. If you just want to control what tab is initially active you can just send in a string like so:

           

          <lui-tab-view> 

                  <lui-tabset active-tab=" 'tab2' "> 

                      <lui-tab ref="tab1">Tab1</lui-tab> 

                      <lui-tab ref="tab2">Tab2</lui-tab> 

                      <lui-tab ref="tab3">Tab3</lui-tab> 

                  </lui-tabset> 

                  <lui-tab-content ref="tab1">Tab1 content</lui-tab-content> 

                  <lui-tab-content ref="tab2">Tab2 content</lui-tab-content> 

                  <lui-tab-content ref="tab3">Tab3 content</lui-tab-content> 

          </lui-tab-view>


          Hope this helps.