0

As the title of this post already says: I'm trying to toggle an icon in my tabcontainer.

I got a TabContainer with some ContentPanes in it.

If I get some values from the database I show them in the ContentPane and set the IconClass so the user see that there is some data.

In the my ContentPane I also got a delete and a save button.

If there was some data and the delete button is pressed I'd like to remove or to hide the Icon in the Tab.

Of course I want to do the other way, too.

But how do I do it?

I tried it with registry.byId("myIdOfTheContentPaneWhereTheIconClasswasDefined").className="dijitNoIcon"

without an effect.

Any ideas?

Keksdose
  • 17
  • 6

2 Answers2

0

Try setting iconClass instead of className.

Proof-of-concept:

require([
    'dijit/layout/TabContainer',
    'dijit/layout/ContentPane'
], function(TabContainer, ContentPane){
    var container = new TabContainer({ id: 'container' }).placeAt(document.body);
    var pane = new ContentPane({
        iconClass: 'dijitIconSave',
        title: 'Tab'
    }).placeAt(container);
    container.startup();

    setTimeout(function () {
        pane.set('iconClass', '');
    }, 2000);
});
Ken Franqueiro
  • 10,559
  • 2
  • 23
  • 40
0

registry.byId returns you a widget, not a domNode.

This should work: registry.byId("myIdOfTheContentPaneWhereTheIconClasswasDefined").domNode.className="dijitNoIcon

although it is not elegant at all...

ben
  • 3,558
  • 1
  • 15
  • 28
  • Sorry for the long delay. For me this helped: var classNameCollection = registry.byId("IDOfMyTabContainer").tablist._selectedTab.childNodes[1].className; var newClassNames = classNameCollection.split("dijitNoIcon"); registry.byId("IDOfMyTabContainer").tablist._selectedTab.childNodes[1].className = newClassNames[0]+" myIconClass"; the same for remove the icon. Just switch the IconClass and the NoIcon Part – Keksdose Jul 08 '15 at 14:22