Our state of the art Gantt chart


Post by compo »

I want to create buttons that appear on the same horizontal space as the tabs do on a tabpanel. The code below shows how it should look like and be pasted right inside the live demo sections code at https://bryntum.com/products/grid/docs/api/Core/widget/TabBar

new TabBar({
    appendTo : targetElement,
    items    : {
        profile : {
            text : 'User profile',
            icon : 'b-fa b-fa-user'
        },
        billing : {
            text : 'Billing',
            icon : 'b-fa b-fa-dollar-sign'
        },
        settings : {
            text : 'Settings',
            icon : 'b-fa b-fa-gear'
        },
        spacer: '->',
        b1 : {
            text: "Button 1"
        }
    }
});

Post by marcio »

Hey compo,

Thanks for reaching out.

Could you please provide some screenshots of the desired result? I added your snippet to the demo and it looks as it should.

Attachments
Screenshot 2024-12-13 at 18.30.33.png
Screenshot 2024-12-13 at 18.30.33.png (60.6 KiB) Viewed 343 times

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post by compo »

The demo of tabbar does show what I want, see the attached screenshot where I have a tabpanel with 3 tabs and a red markup where I want the button to show but it does not show. The screenshow shows a tabpanel with 3 tabs, each tab is a gantt chart. I want a button to the right of the tabs (red markup).

I did eventually figure it out by using the tabpanel's tabbar config, see below that gave me what I wanted

                items: [...],
                tabBar: {
                    items: {
                        spacer: '->',
                        sayHi: {
                            text: 'Say Hi',
                            // cls: 'b-blue b-raised',
                            iconCls: 'b-fa b-fa-table',
                            onAction: () => alert('Hi')
                        }
                    }
                }
Screenshot 2024-12-14 075958.png
Screenshot 2024-12-14 075958.png (18.28 KiB) Viewed 316 times

Post by Animal »

You will need to add type : ‘button’ because the defaultType for a TabBar is a Tab.


Post by compo »

Thank you,

Is there a feature in the Bryntum Library to easily display a right click context menu when the user right clicks the tabs of a tab panel? For example right click the first Table and click delete to remove the tab.


Post by mats »

Great suggestion, we don't support this yet but should be very easy to add yourself if you get familiar with the Tab + Menu classes. FR: https://github.com/bryntum/support/issues/10487


Post by compo »

Thanks,

I was able to add a context menu by calling the code below after adding a tab. NOTE: I needed to use menu1 instead of menu, using menu would result in a menu drop down icon getting added for things like button objects.

I was also wondering if there is a framework way to support reordering tabs with drag drop, I did not see anything jump out at me in the API docs

        tab.tab.element.addEventListener('contextmenu', event => {
            console.log('contextmenu');
            event.preventDefault();

        if (!tab.tab.menu1) {
            tab.tab.menu1 = new Menu({
                anchor: true,

                owner: tab, // Ensure menu is destroyed when the owning tab is destroyed
                items: [
                  ...
                ],
                // Method is called for all ancestor levels
                onItem({ item }) {
                    Toast.show('You clicked ' + item.text);
                }
            });
        }

        tab.tab.menu1.showBy(tab.tab);
    });

Post by alex.l »

Hi compo,

We do not support tabs reordering with drag-n-drop.

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by alex.l »

I've opened a FR for your request here https://github.com/bryntum/support/issues/10489

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post Reply