Search code examples
javagwtgxttabpanel

Removing the default close tab option of a GXT Tabpanel?


So I'm using GWT + GXT and have created a GXT Tabpanel (see a similar demo/source displaying the basics of what I have here - be sure to go to the tabs > basic tabs section).

Once rendered, it's styling is shown like below:

enter image description here

Clicking on the anchors (small crosses in the top right-hand corner) results in that tab being closed. However, this is a piece of default behaviour I don't want, and would like to remove.

Say my TabPanel is simply:

panel= new TabPanel();
panel. ............... // Method to remove all tabs 'close tab' option.

panel.add(datacenterGrid, new TabItemConfig("Datacenter", true)); // Adding tab one
panel.add(clusterGrid, new TabItemConfig("Cluster", true)); // Adding tab two

Which Tabpanel method could I use to simply remove the close tab option? (Apologies if it's something simple and I'm being stupid, this area's new to me and I couldn't see any obvious method for it in the documentation).


Solution

  • If you want to remove the close button, just mark the tab as not closable.

    You can do this with method: TabPanel.add(Widget widget, TabItemConfig config);

    See setters on TabItemConfig

    Now, if you really want to customize the menu, I already asked how to do it here.