Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9139869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:26:35+00:00 2026-06-17T09:26:35+00:00

I am creating dynamic tabs . I have created 1st tab then 2nd tab

  • 0

I am creating dynamic tabs. I have created 1st tab then 2nd tab etc. When I am at 3rd tab, I want the user not to be able to select the other tabs, or in other words, user will not be able to move from one tab to other tabs.

I am using event.propagation(); to stop the event but it is not working. Does anyone have other solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:26:35+00:00Added an answer on June 17, 2026 at 9:26 am

    Try this:

    zul

    <zk>
        <div apply="test.TestComposer">
            <tabbox>
                <tabs id="tbs" />
                <tabpanels id="tps" />
            </tabbox>
            <button id="btn" label="add tab" />
        </div>
    </zk>
    

    TestComposer.java

    package test;
    
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;
    
    import org.zkoss.zk.ui.Component;
    import org.zkoss.zk.ui.event.*;
    import org.zkoss.zk.ui.select.SelectorComposer;
    import org.zkoss.zk.ui.select.annotation.Listen;
    import org.zkoss.zk.ui.select.annotation.Wire;
    import org.zkoss.zk.ui.util.Clients;
    import org.zkoss.zul.Button;
    import org.zkoss.zul.Label;
    import org.zkoss.zul.Tab;
    import org.zkoss.zul.Tabpanel;
    import org.zkoss.zul.Tabpanels;
    import org.zkoss.zul.Tabs;
    
    /**
     * Tested with ZK 6.0.2 and ZK Pivottable 2.0.0
     *
     */
    @SuppressWarnings("rawtypes")
    public class TestComposer extends SelectorComposer {
        @Wire
        Button btn;
        @Wire
        Tabs tbs;
        @Wire
        Tabpanels tps;
        List tabs = new ArrayList();
        int limit = 3;
    
        @Listen("onClick = #btn")
        public void onClick$btn () {
            if (tabs.size() < limit) {
                Tab tab = new Tab("Tab " + (tabs.size()+1));
                tab.setParent(tbs);
                tabs.add(tab);
                Tabpanel tp = new Tabpanel();
                new Label("Tabpanel " + tabs.size()).setParent(tp);
                tp.setParent(tps);
    
                if (tabs.size() == limit) {
                    tab.setSelected(true);
                    overrideBehavior();
                }
            }
        }
        public void overrideBehavior () {
            final Tab toSel = (Tab)tabs.get(tabs.size()-1);
            for (int i = 0; i < tabs.size() - 1; i++) {
                final Tab tab = (Tab)tabs.get(i);
                tab.addEventListener( // add an EventListener
                        "onClick", // listen to onClick event
                        new EventListener () { // create an EventListener instance to add
                            public void onEvent (Event event) { // the method will be called while onClick event triggered
                                Clients.evalJavaScript("zk.log('"+tab+"  clicked')");
                                toSel.setSelected(true); // make sure the third one is selected at server side
                            }
                        }
                    );
                    tab.setWidgetOverride("_sel", "function(notify, init) {return;}"); // prevent select at client side
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating dynamic text boxes on button click and then showing values on
Was wondering if anyone had any smart approaches to creating dynamic vanity user urls
I have a scenario that, I am creating dynamic html content and I need
I have made a sample of creating a jquery ui tabs, i am creating
i am creating dynamic controls in my asp.net application. Each time i have to
I'm using AngularJS with Rails and creating dynamic nested form items which are not
Hi there i want to create a dynamic functionality like creating dynamic form in
I have used Android phonegap application for creating dynamic list with label and corresponding
I am creating dynamic web project in Eclipse. I have the .java files in
We have many environments and thinking of creating dynamic application configuration as part of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.