NavItem
The NavItem control is the default control of navigation-related components. It can contain other controls as nested items.
Add NavItem
Use the add() method of TreeCollection to add a NavItem control to a sidebar:
sidebar.data.add({
type:"navItem", value:"My NavItem"
});
Related sample: Sidebar. Navigation items
Properties
Check the list of properties that you can set in the configuration object of a NavItem control.
Add an icon
Use the icon property to add an icon to a NavItem control:
{
type:"navItem", value:"Some",
icon:"dxi dxi-check"
}
Add a badge with a number
Use the count property to add a badge with a number to a NavItem control, for example, to count new messages:
{
type:"navItem", value:"Some",
icon:"dxi dxi-check",
count:10
}
Add HTML content
Use the html property to add custom HTML content to a NavItem control:
{
type: "navItem",
html: "<img className='item-avatar' src='../avatars/Avatar_07.jpg'/>"
}
Related sample: Sidebar. Item HTML content
Show and hide a NavItem
The show() and hide() methods of Sidebar show and hide a NavItem control by its ID:
sidebar.show(id);
sidebar.hide(id);
Enable and disable a NavItem
The enable() and disable() methods enable and disable a NavItem control by its ID:
sidebar.enable(id);
sidebar.disable(id);
Add a tooltip
Use the tooltip property to add a tooltip to a NavItem control:
{
type:"navItem",
value:"Click",
tooltip:"Click me and find out why"
}