A.G.Progm.Enthusiast
A.G.Progm.Enthusiast

Reputation: 1010

How to add a deleted tab in the same position and with same content of the tabview in Webix?

I am having a Webix application with tabview. It has four tabs and they can be deleted by the 'x' button on their tab header. To create a deleted tab one needs to click on the tab name list in the left panel.

Snippet : https://webix.com/snippet/d637a6af

My requirement goes as follows:

1. The initial tab order is A,B,C,D respectively. If I delete B-tab, I want it to be added at the same place i.e between A and C. Is there a way to achieve that ?

  1. Also, when a deleted tab is added, it is not showing the corresponding template content. Instead it is showing the currently selected tab content meaning if B tab is deleted and added again, B tab content shows the template of C-tab which was selected at the time of adding B-tab. How can I show the appropriate tab content ?

Thanks.

Upvotes: 0

Views: 148

Answers (1)

Aquatic
Aquatic

Reputation: 5144

(1)

If you want to preserve order of existing tab, probably it will be better to hide|show tabs instead of fully removing them

function open_new_tab(id) {
    $$("mytabview").getTabbar().showOption(id+"tpl");
}

and

tabbar:{
        on: {
            "onBeforeTabClose":function(id){
              this.hideOption(id);
              this.refresh();
              return false;
            }
        }
      },

https://webix.com/snippet/73210568 https://docs.webix.com/api__link__ui.tabbar_hideoption.html

(2)

You need to use the same id for tab and for tab content, so instead of tabbar.add("a", text) you need to use tabbar.add("atpl",

Upvotes: 1

Related Questions