Skip to main content

Menubar

SQL Frames DataFrames UI comes with a menubar that provides various features. It is also context sensitive, that is, the menu options vary based on the type of the DataFrame. For example, a pivoted DataFrame may show the Transpose menu option.

Disabling Menubar

It is possible to disable left or right menubar sections for all the DataFrames or specfic DataFrames.

Loading...
note

Disabling the menubars for all DataFrames is possible by using DataFrame.Config.ShowMenubarLeft and DataFrame.Config.ShowMenubarRight

Configuring Menubar Options

Usually it is not a good idea to completely disable the menubar options as SQL Frames provides several useful actions out of the box. A better option might be customize the menubar to expose only the desired actions.

The df.ui.menu object contains the menubar definition. The format of this menu definition has the following type

type MenuItem = {
id: string,
name?: string,
onclick?: (evt: HTMLElement) => void,
hide?: boolean,
} | MenuSection;

type MenuSection = {
id?: string,
name?: string,
items: (MenuItem|MenuItem[])[],
hide?: boolean,
display?: 'inline'|'submenu', // default is 'inline'
}

type Menu = MenuSection;

type Menubar = Menu[];

To add a custom menu

Loading...
Customization

The df.ui.menu is just an Array with all the built-in menu definitions already added. These options can be customized as needed.

Do note that the OOTB menu options may be rearranged from release to release. Hence any customization may require rework to uptake latest changes.

It is possible to organize menus into submenus by specifying displsy as 'submenu'.

Loading...