Search code examples
dojotitlebar

How to add buttons to dojo titlepane


Is there any way to add buttons to TitlePane header(right side of title bar), so that i can do some operations(download,delete...)

Thanks in advance.


Solution

  • There is. I was able to do it using the .placeAt() method in the added dijit's creation, such as below:

    In index.htm

    <div id="divMap"></div>
    

    In main.js within callback

    ready (function() {
        var ttpMyTitlePane = new TitlePane({
            title: 'My Title'
        });
        divMenu.appendChild(ttpMyTitlePane.domNode);
    
        var btnMyButton = new Button({
            label: 'ButtonText',
            onClick: function() {
                // do stuff
            } 
        }).placeAt(ttpMyTitlePane.domNode);
    }