From the reference libraryRedM

JO Menu

jo_libs/modules/menu/functions.md

JO Menu

A client side library to use the JO Menu in your scripts.
JO Menu is a NUI menu fully optimized and mouse and keyboard ready.

Usage

Download an example of menu resource

Constructor > <BadgeClient /> jo.menu.create()

<!-- @include: ./slots/headers.md#client|jo.menu.create -->

Create a new menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.create -->

Constructor > <BadgeClient /> jo.menu.create() > Syntax

jo.menu.create(id, data)

Constructor > <BadgeClient /> jo.menu.create() > Parameters

id : string

Unique ID of the menu

data : table <BadgeOptional />

Menu configuration data

data.title : string - The big title of the menu The menu title

data.subtitle : string - The subtitle of the menu The subtitle

data.numberOnScreen : integer - Maximum number of items visibles at the same time <br> default : 8 <BadgeOptional />

data.distanceToClose : float - Distance at which the menu will self close if the player is moving away <br> default: false

data.onEnter : function - Fired when the menu is opened <BadgeOptional />

data.onBack : function - Fired when the backspace/Escape is pressed <BadgeOptional />

data.onExit : function - Fired when the menu is exited <BadgeOptional />

data.onTick : function - Fired every tick <BadgeOptional />

Constructor > <BadgeClient /> jo.menu.create() > Return Value

Type : MenuClass

The newly created menu object

<!-- @include: ./slots/examples.md#client|jo.menu.create -->

<!-- @include: ./slots/footers.md#client|jo.menu.create -->

MenuClass Methods > <BadgeClient /> MenuClass:addItem()

<!-- @include: ./slots/headers.md#client|MenuClass:addItem -->

Add an item to a menu <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:addItem -->

MenuClass Methods > <BadgeClient /> MenuClass:addItem() > Syntax

MenuClass:addItem(index, item)

MenuClass Methods > <BadgeClient /> MenuClass:addItem() > Parameters

index : integer|table

Position index or item table if used as single parameter

item : table <BadgeOptional />

The item to add - if not provided, p is used as the item

item.title : string - The item label

item.child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

item.visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

item.data : table - Variable to store custom data in the item <BadgeOptional />

item.description : string - Description text for the item <BadgeOptional />

item.prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

item.icon : string - The left icon filename from nui\menu\assets\images\icons folder Icon <BadgeOptional />

item.iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

item.iconClass : string - CSS class for the icon <BadgeOptional />

item.price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

item.price.money : number - The price in $ <BadgeOptional />

item.price.gold : number - The price in gold <BadgeOptional />

item.priceTitle : string - Replace the "Price" label <BadgeOptional />

item.priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

item.statistics : table - List of statistics to display for the item <BadgeOptional />

item.disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

item.textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

item.previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

item.sliders : table - List of sliders for the item <BadgeOptional />

item.onActive : function - Fired when the item is selected <BadgeOptional />

item.onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

item.onChange : function - Fired when a slider value changes <BadgeOptional />

item.onExit : function - Fired when the item is exited <BadgeOptional />

item.onTick : function - Fired every tick <BadgeOptional />

MenuClass Methods > <BadgeClient /> MenuClass:addItem() > Return Value

Type : MenuItemClass

The added item

<!-- @include: ./slots/examples.md#client|MenuClass:addItem -->

<!-- @include: ./slots/footers.md#client|MenuClass:addItem -->


MenuClass Methods > <BadgeClient /> MenuClass:deleteValue()

<!-- @include: ./slots/headers.md#client|MenuClass:deleteValue -->

Delete a specific property of a menu. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:deleteValue -->

MenuClass Methods > <BadgeClient /> MenuClass:deleteValue() > Syntax

MenuClass:deleteValue(keys)

MenuClass Methods > <BadgeClient /> MenuClass:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value

<!-- @include: ./slots/examples.md#client|MenuClass:deleteValue -->

<!-- @include: ./slots/footers.md#client|MenuClass:deleteValue -->


MenuClass Methods > <BadgeClient /> MenuClass:push()

<!-- @include: ./slots/headers.md#client|MenuClass:push -->

Push the updated values to the NUI layer <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:push -->

MenuClass Methods > <BadgeClient /> MenuClass:push() > Syntax

MenuClass:push()

<!-- @include: ./slots/examples.md#client|MenuClass:push -->

<!-- @include: ./slots/footers.md#client|MenuClass:push -->


MenuClass Methods > <BadgeClient /> MenuClass:refresh()

<!-- @include: ./slots/headers.md#client|MenuClass:refresh -->

Refresh all the menu without changing the current state <br> Used when you want rebuild the menu <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:refresh -->

MenuClass Methods > <BadgeClient /> MenuClass:refresh() > Syntax

MenuClass:refresh()

<!-- @include: ./slots/examples.md#client|MenuClass:refresh -->

<!-- @include: ./slots/footers.md#client|MenuClass:refresh -->


MenuClass Methods > <BadgeClient /> MenuClass:removeItem()

<!-- @include: ./slots/headers.md#client|MenuClass:removeItem -->

Remove an item from a menu by its index. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:removeItem -->

MenuClass Methods > <BadgeClient /> MenuClass:removeItem() > Syntax

MenuClass:removeItem(index)

MenuClass Methods > <BadgeClient /> MenuClass:removeItem() > Parameters

index : integer

The index of the item to remove

<!-- @include: ./slots/examples.md#client|MenuClass:removeItem -->

<!-- @include: ./slots/footers.md#client|MenuClass:removeItem -->


MenuClass Methods > <BadgeClient /> MenuClass:reset()

<!-- @include: ./slots/headers.md#client|MenuClass:reset -->

Reset the menu to its initial state <br> Moves the cursor back to the first item <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:reset -->

MenuClass Methods > <BadgeClient /> MenuClass:reset() > Syntax

MenuClass:reset()

<!-- @include: ./slots/examples.md#client|MenuClass:reset -->

<!-- @include: ./slots/footers.md#client|MenuClass:reset -->


MenuClass Methods > <BadgeClient /> MenuClass:send()

<!-- @include: ./slots/headers.md#client|MenuClass:send -->

Send the menu data to the NUI layer <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:send -->

MenuClass Methods > <BadgeClient /> MenuClass:send() > Syntax

MenuClass:send()

<!-- @include: ./slots/examples.md#client|MenuClass:send -->

<!-- @include: ./slots/footers.md#client|MenuClass:send -->


MenuClass Methods > <BadgeClient /> MenuClass:setCurrentIndex()

<!-- @include: ./slots/headers.md#client|MenuClass:setCurrentIndex -->

Change the current active item index <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:setCurrentIndex -->

MenuClass Methods > <BadgeClient /> MenuClass:setCurrentIndex() > Syntax

MenuClass:setCurrentIndex(index)

MenuClass Methods > <BadgeClient /> MenuClass:setCurrentIndex() > Parameters

index : integer

The item index to switch to

<!-- @include: ./slots/examples.md#client|MenuClass:setCurrentIndex -->

<!-- @include: ./slots/footers.md#client|MenuClass:setCurrentIndex -->


MenuClass Methods > <BadgeClient /> MenuClass:sort()

<!-- @include: ./slots/headers.md#client|MenuClass:sort -->

Sort menu items alphabetically by title <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:sort -->

MenuClass Methods > <BadgeClient /> MenuClass:sort() > Syntax

MenuClass:sort(first, last)

MenuClass Methods > <BadgeClient /> MenuClass:sort() > Parameters

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.items

<!-- @include: ./slots/examples.md#client|MenuClass:sort -->

<!-- @include: ./slots/footers.md#client|MenuClass:sort -->


MenuClass Methods > <BadgeClient /> MenuClass:updateValue()

<!-- @include: ./slots/headers.md#client|MenuClass:updateValue -->

Update a specific property of a menu. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:updateValue -->

MenuClass Methods > <BadgeClient /> MenuClass:updateValue() > Syntax

MenuClass:updateValue(keys, value)

MenuClass Methods > <BadgeClient /> MenuClass:updateValue() > Parameters

keys : string|table

The list of property name to access to the value

value : any

The new value

<!-- @include: ./slots/examples.md#client|MenuClass:updateValue -->

<!-- @include: ./slots/footers.md#client|MenuClass:updateValue -->


MenuClass Methods > <BadgeClient /> MenuClass:use()

<!-- @include: ./slots/headers.md#client|MenuClass:use -->

Set this menu as the current active menu <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:use -->

MenuClass Methods > <BadgeClient /> MenuClass:use() > Syntax

MenuClass:use(keepHistoric, resetMenu)

MenuClass Methods > <BadgeClient /> MenuClass:use() > Parameters

keepHistoric : boolean <BadgeOptional />

Whether to keep navigation history <br> default: true

resetMenu : boolean <BadgeOptional />

Whether to reset the menu state <br> default: true

<!-- @include: ./slots/examples.md#client|MenuClass:use -->

<!-- @include: ./slots/footers.md#client|MenuClass:use -->


MenuClass Methods > <BadgeClient /> MenuClass:updateItem()

:::danger Deprecated since v2.3.0. Use MenuClass:updateValue or MenuClass:deleteValue instead :::

<!-- @include: ./slots/headers.md#client|MenuClass:updateItem -->

Update a specific property of a menu item <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:updateItem -->

MenuClass Methods > <BadgeClient /> MenuClass:updateItem() > Syntax

MenuClass:updateItem(index, key, value)

MenuClass Methods > <BadgeClient /> MenuClass:updateItem() > Parameters

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property

<!-- @include: ./slots/examples.md#client|MenuClass:updateItem -->

<!-- @include: ./slots/footers.md#client|MenuClass:updateItem -->

MenuItem Methods > <BadgeClient /> MenuItem:deleteValue()

<!-- @include: ./slots/headers.md#client|MenuItem:deleteValue -->

Delete a specific property of a menu item. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuItem:deleteValue -->

MenuItem Methods > <BadgeClient /> MenuItem:deleteValue() > Syntax

MenuItem:deleteValue(keys)

MenuItem Methods > <BadgeClient /> MenuItem:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value

<!-- @include: ./slots/examples.md#client|MenuItem:deleteValue -->

<!-- @include: ./slots/footers.md#client|MenuItem:deleteValue -->


MenuItem Methods > <BadgeClient /> MenuItem:getParentMenu()

<!-- @include: ./slots/headers.md#client|MenuItem:getParentMenu -->

Get the parent menu of the item <br>

<!-- @include: ./slots/descriptions.md#client|MenuItem:getParentMenu -->

MenuItem Methods > <BadgeClient /> MenuItem:getParentMenu() > Syntax

MenuItem:getParentMenu()

MenuItem Methods > <BadgeClient /> MenuItem:getParentMenu() > Return Value

Type : MenuClass

The parent menu

<!-- @include: ./slots/examples.md#client|MenuItem:getParentMenu -->

<!-- @include: ./slots/footers.md#client|MenuItem:getParentMenu -->


MenuItem Methods > <BadgeClient /> MenuItem:updateValue()

<!-- @include: ./slots/headers.md#client|MenuItem:updateValue -->

Update a specific property of a menu item. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuItem:updateValue -->

MenuItem Methods > <BadgeClient /> MenuItem:updateValue() > Syntax

MenuItem:updateValue(keys, value)

MenuItem Methods > <BadgeClient /> MenuItem:updateValue() > Parameters

keys : string|table

The property name to update

value : any

The new value for the property

<!-- @include: ./slots/examples.md#client|MenuItem:updateValue -->

<!-- @include: ./slots/footers.md#client|MenuItem:updateValue -->

JO Functions > <BadgeClient /> jo.menu.addItem()

<!-- @include: ./slots/headers.md#client|jo.menu.addItem -->

Add an item to a menu by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.addItem -->

JO Functions > <BadgeClient /> jo.menu.addItem() > Syntax

jo.menu.addItem(id, p, item)

JO Functions > <BadgeClient /> jo.menu.addItem() > Parameters

id : string

The menu ID

p : integer|table

Position index or item table if used as single parameter

item : table <BadgeOptional />

The item to add - if not provided, p is used as the item

item.title : string - The item label

item.child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

item.visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

item.data : table - Variable to store custom data in the item <BadgeOptional />

item.description : string - Description text for the item <BadgeOptional />

item.prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

item.icon : string - The left icon filename from nui\menu\assets\images\icons folder Icon <BadgeOptional />

item.iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

item.iconClass : string - CSS class for the icon <BadgeOptional />

item.price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

item.price.money : number - The price in $ <BadgeOptional />

item.price.gold : number - The price in gold <BadgeOptional />

item.priceTitle : string - Replace the "Price" label <BadgeOptional />

item.priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

item.statistics : table - List of statistics to display for the item <BadgeOptional />

item.disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

item.textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

item.previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

item.sliders : table - List of sliders for the item <BadgeOptional />

item.onActive : function - Fired when the item is selected <BadgeOptional />

item.onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

item.onChange : function - Fired when a slider value changes <BadgeOptional />

item.onExit : function - Fired when the item is exited <BadgeOptional />

<!-- @include: ./slots/examples.md#client|jo.menu.addItem -->

<!-- @include: ./slots/footers.md#client|jo.menu.addItem -->


JO Functions > <BadgeClient /> jo.menu.delete()

<!-- @include: ./slots/headers.md#client|jo.menu.delete -->

Delete a menu from memory <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.delete -->

JO Functions > <BadgeClient /> jo.menu.delete() > Syntax

jo.menu.delete(id)

JO Functions > <BadgeClient /> jo.menu.delete() > Parameters

id : string

The menu ID to delete

<!-- @include: ./slots/examples.md#client|jo.menu.delete -->

<!-- @include: ./slots/footers.md#client|jo.menu.delete -->


JO Functions > <BadgeClient /> jo.menu.displayLoader()

<!-- @include: ./slots/headers.md#client|jo.menu.displayLoader -->

A function to display the loader <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.displayLoader -->

JO Functions > <BadgeClient /> jo.menu.displayLoader() > Syntax

jo.menu.displayLoader(value)

JO Functions > <BadgeClient /> jo.menu.displayLoader() > Parameters

value : boolean <BadgeOptional />

Whether to display the loader <br> default: true

<!-- @include: ./slots/examples.md#client|jo.menu.displayLoader -->

<!-- @include: ./slots/footers.md#client|jo.menu.displayLoader -->


JO Functions > <BadgeClient /> jo.menu.doesActiveButtonChange()

<!-- @include: ./slots/headers.md#client|jo.menu.doesActiveButtonChange -->

Check if the active button has changed since last update <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.doesActiveButtonChange -->

JO Functions > <BadgeClient /> jo.menu.doesActiveButtonChange() > Syntax

jo.menu.doesActiveButtonChange()

JO Functions > <BadgeClient /> jo.menu.doesActiveButtonChange() > Return Value

Type : boolean

Returns true if the active button has changed

<!-- @include: ./slots/examples.md#client|jo.menu.doesActiveButtonChange -->

<!-- @include: ./slots/footers.md#client|jo.menu.doesActiveButtonChange -->


JO Functions > <BadgeClient /> jo.menu.fireAllLevelsEvent()

<!-- @include: ./slots/headers.md#client|jo.menu.fireAllLevelsEvent -->

Fire an event across all menu levels (current menu and current item) <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.fireAllLevelsEvent -->

JO Functions > <BadgeClient /> jo.menu.fireAllLevelsEvent() > Syntax

jo.menu.fireAllLevelsEvent(eventName, ...)

JO Functions > <BadgeClient /> jo.menu.fireAllLevelsEvent() > Parameters

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handlers

<!-- @include: ./slots/examples.md#client|jo.menu.fireAllLevelsEvent -->

<!-- @include: ./slots/footers.md#client|jo.menu.fireAllLevelsEvent -->


JO Functions > <BadgeClient /> jo.menu.fireEvent()

<!-- @include: ./slots/headers.md#client|jo.menu.fireEvent -->

Fire an event for a specific menu item <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.fireEvent -->

JO Functions > <BadgeClient /> jo.menu.fireEvent() > Syntax

jo.menu.fireEvent(item, eventName, ...)

JO Functions > <BadgeClient /> jo.menu.fireEvent() > Parameters

item : table

The item to trigger the event on

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handler

<!-- @include: ./slots/examples.md#client|jo.menu.fireEvent -->

<!-- @include: ./slots/footers.md#client|jo.menu.fireEvent -->


JO Functions > <BadgeClient /> jo.menu.forceBack()

<!-- @include: ./slots/headers.md#client|jo.menu.forceBack -->

Force the menu to go back to the previous menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.forceBack -->

JO Functions > <BadgeClient /> jo.menu.forceBack() > Syntax

jo.menu.forceBack()

<!-- @include: ./slots/examples.md#client|jo.menu.forceBack -->

<!-- @include: ./slots/footers.md#client|jo.menu.forceBack -->


JO Functions > <BadgeClient /> jo.menu.get()

<!-- @include: ./slots/headers.md#client|jo.menu.get -->

Get a menu instance by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.get -->

JO Functions > <BadgeClient /> jo.menu.get() > Syntax

jo.menu.get(id)

JO Functions > <BadgeClient /> jo.menu.get() > Parameters

id : string

The menu ID

JO Functions > <BadgeClient /> jo.menu.get() > Return Value

Type : MenuClass

The menu object

<!-- @include: ./slots/examples.md#client|jo.menu.get -->

<!-- @include: ./slots/footers.md#client|jo.menu.get -->


JO Functions > <BadgeClient /> jo.menu.getCurrentData()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentData -->

Get data about the current menu state <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentData -->

JO Functions > <BadgeClient /> jo.menu.getCurrentData() > Syntax

jo.menu.getCurrentData()

JO Functions > <BadgeClient /> jo.menu.getCurrentData() > Return Value

Type : table

Current menu data including menu ID and selected item

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentData -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentData -->


JO Functions > <BadgeClient /> jo.menu.getCurrentIndex()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentIndex -->

A function to get the current index <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentIndex -->

JO Functions > <BadgeClient /> jo.menu.getCurrentIndex() > Syntax

jo.menu.getCurrentIndex()

JO Functions > <BadgeClient /> jo.menu.getCurrentIndex() > Return Value

Type : integer

The index of the current item

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentIndex -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentIndex -->


JO Functions > <BadgeClient /> jo.menu.getCurrentItem()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentItem -->

Get the currently selected menu item <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentItem -->

JO Functions > <BadgeClient /> jo.menu.getCurrentItem() > Syntax

jo.menu.getCurrentItem()

JO Functions > <BadgeClient /> jo.menu.getCurrentItem() > Return Value

Type : table

The currently selected item

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentItem -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentItem -->


JO Functions > <BadgeClient /> jo.menu.getCurrentMenu()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentMenu -->

Get the currently active menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentMenu -->

JO Functions > <BadgeClient /> jo.menu.getCurrentMenu() > Syntax

jo.menu.getCurrentMenu()

JO Functions > <BadgeClient /> jo.menu.getCurrentMenu() > Return Value

Type : MenuClass

The currently active menu

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentMenu -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentMenu -->


JO Functions > <BadgeClient /> jo.menu.getCurrentMenuId()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentMenuId -->

A function to get the current menu id <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentMenuId -->

JO Functions > <BadgeClient /> jo.menu.getCurrentMenuId() > Syntax

jo.menu.getCurrentMenuId()

JO Functions > <BadgeClient /> jo.menu.getCurrentMenuId() > Return Value

Type : string

The id of the current menu

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentMenuId -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentMenuId -->


JO Functions > <BadgeClient /> jo.menu.getPreviousData()

<!-- @include: ./slots/headers.md#client|jo.menu.getPreviousData -->

Get data about the previous menu state <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getPreviousData -->

JO Functions > <BadgeClient /> jo.menu.getPreviousData() > Syntax

jo.menu.getPreviousData()

JO Functions > <BadgeClient /> jo.menu.getPreviousData() > Return Value

Type : table

Previous menu data including menu ID and selected item

<!-- @include: ./slots/examples.md#client|jo.menu.getPreviousData -->

<!-- @include: ./slots/footers.md#client|jo.menu.getPreviousData -->


JO Functions > <BadgeClient /> jo.menu.hideLoader()

<!-- @include: ./slots/headers.md#client|jo.menu.hideLoader -->

A function to hide the loader <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.hideLoader -->

JO Functions > <BadgeClient /> jo.menu.hideLoader() > Syntax

jo.menu.hideLoader()

<!-- @include: ./slots/examples.md#client|jo.menu.hideLoader -->

<!-- @include: ./slots/footers.md#client|jo.menu.hideLoader -->


JO Functions > <BadgeClient /> jo.menu.isCurrentMenu()

<!-- @include: ./slots/headers.md#client|jo.menu.isCurrentMenu -->

A function to know if the menu is the current one <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.isCurrentMenu -->

JO Functions > <BadgeClient /> jo.menu.isCurrentMenu() > Syntax

jo.menu.isCurrentMenu(id)

JO Functions > <BadgeClient /> jo.menu.isCurrentMenu() > Parameters

id : string

The menu id

JO Functions > <BadgeClient /> jo.menu.isCurrentMenu() > Return Value

Type : boolean

<!-- @include: ./slots/examples.md#client|jo.menu.isCurrentMenu -->

<!-- @include: ./slots/footers.md#client|jo.menu.isCurrentMenu -->


JO Functions > <BadgeClient /> jo.menu.isExist()

<!-- @include: ./slots/headers.md#client|jo.menu.isExist -->

Check if a menu exist <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.isExist -->

JO Functions > <BadgeClient /> jo.menu.isExist() > Syntax

jo.menu.isExist(id)

JO Functions > <BadgeClient /> jo.menu.isExist() > Parameters

id : string

the menu ID

JO Functions > <BadgeClient /> jo.menu.isExist() > Return Value

Type : boolean

Returns true if the menu exists

<!-- @include: ./slots/examples.md#client|jo.menu.isExist -->

<!-- @include: ./slots/footers.md#client|jo.menu.isExist -->


JO Functions > <BadgeClient /> jo.menu.isOpen()

<!-- @include: ./slots/headers.md#client|jo.menu.isOpen -->

Check if any menu is currently open <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.isOpen -->

JO Functions > <BadgeClient /> jo.menu.isOpen() > Syntax

jo.menu.isOpen()

JO Functions > <BadgeClient /> jo.menu.isOpen() > Return Value

Type : boolean

Returns true if a menu is open

<!-- @include: ./slots/examples.md#client|jo.menu.isOpen -->

<!-- @include: ./slots/footers.md#client|jo.menu.isOpen -->


JO Functions > <BadgeClient /> jo.menu.missingMenuHandler()

<!-- @include: ./slots/headers.md#client|jo.menu.missingMenuHandler -->

<br> <br> Register a handler for missing menu error <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.missingMenuHandler -->

JO Functions > <BadgeClient /> jo.menu.missingMenuHandler() > Syntax

jo.menu.missingMenuHandler(id, callback)

JO Functions > <BadgeClient /> jo.menu.missingMenuHandler() > Parameters

id : string

The menu ID

callback : function

The handler function

<!-- @include: ./slots/examples.md#client|jo.menu.missingMenuHandler -->

<!-- @include: ./slots/footers.md#client|jo.menu.missingMenuHandler -->


JO Functions > <BadgeClient /> jo.menu.onChange()

<!-- @include: ./slots/headers.md#client|jo.menu.onChange -->

Register a callback function for menu change events <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.onChange -->

JO Functions > <BadgeClient /> jo.menu.onChange() > Syntax

jo.menu.onChange(cb)

JO Functions > <BadgeClient /> jo.menu.onChange() > Parameters

cb : function

The callback function to register

<!-- @include: ./slots/examples.md#client|jo.menu.onChange -->

<!-- @include: ./slots/footers.md#client|jo.menu.onChange -->


JO Functions > <BadgeClient /> jo.menu.playAudio()

<!-- @include: ./slots/headers.md#client|jo.menu.playAudio -->

A function to play a NUI sound <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.playAudio -->

JO Functions > <BadgeClient /> jo.menu.playAudio() > Syntax

jo.menu.playAudio(sound)

JO Functions > <BadgeClient /> jo.menu.playAudio() > Parameters

sound : string

<!-- @include: ./slots/examples.md#client|jo.menu.playAudio -->

<!-- @include: ./slots/footers.md#client|jo.menu.playAudio -->


JO Functions > <BadgeClient /> jo.menu.refresh()

<!-- @include: ./slots/headers.md#client|jo.menu.refresh -->

Refresh a menu by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.refresh -->

JO Functions > <BadgeClient /> jo.menu.refresh() > Syntax

jo.menu.refresh(id)

JO Functions > <BadgeClient /> jo.menu.refresh() > Parameters

id : string

The menu ID to refresh

<!-- @include: ./slots/examples.md#client|jo.menu.refresh -->

<!-- @include: ./slots/footers.md#client|jo.menu.refresh -->


JO Functions > <BadgeClient /> jo.menu.reset()

<!-- @include: ./slots/headers.md#client|jo.menu.reset -->

Reset a menu by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.reset -->

JO Functions > <BadgeClient /> jo.menu.reset() > Syntax

jo.menu.reset(id)

JO Functions > <BadgeClient /> jo.menu.reset() > Parameters

id : string

The menu ID to reset

<!-- @include: ./slots/examples.md#client|jo.menu.reset -->

<!-- @include: ./slots/footers.md#client|jo.menu.reset -->


JO Functions > <BadgeClient /> jo.menu.runRefreshEvents()

<!-- @include: ./slots/headers.md#client|jo.menu.runRefreshEvents -->

A function to fire menu and items events <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.runRefreshEvents -->

JO Functions > <BadgeClient /> jo.menu.runRefreshEvents() > Syntax

jo.menu.runRefreshEvents(menuEvent, itemEvent)

JO Functions > <BadgeClient /> jo.menu.runRefreshEvents() > Parameters

menuEvent : boolean <BadgeOptional />

Whether to run menu events

itemEvent : boolean <BadgeOptional />

Whether to run item events

<!-- @include: ./slots/examples.md#client|jo.menu.runRefreshEvents -->

<!-- @include: ./slots/footers.md#client|jo.menu.runRefreshEvents -->


JO Functions > <BadgeClient /> jo.menu.send()

<!-- @include: ./slots/headers.md#client|jo.menu.send -->

Send a menu to the NUI layer by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.send -->

JO Functions > <BadgeClient /> jo.menu.send() > Syntax

jo.menu.send(id)

JO Functions > <BadgeClient /> jo.menu.send() > Parameters

id : string

The menu ID

<!-- @include: ./slots/examples.md#client|jo.menu.send -->

<!-- @include: ./slots/footers.md#client|jo.menu.send -->


JO Functions > <BadgeClient /> jo.menu.set()

<!-- @include: ./slots/headers.md#client|jo.menu.set -->

Set or replace a menu instance <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.set -->

JO Functions > <BadgeClient /> jo.menu.set() > Syntax

jo.menu.set(id, menu)

JO Functions > <BadgeClient /> jo.menu.set() > Parameters

id : string

The menu ID

menu : MenuClass

The menu object to set

<!-- @include: ./slots/examples.md#client|jo.menu.set -->

<!-- @include: ./slots/footers.md#client|jo.menu.set -->


JO Functions > <BadgeClient /> jo.menu.setCurrentMenu()

<!-- @include: ./slots/headers.md#client|jo.menu.setCurrentMenu -->

Set a menu as the current active menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.setCurrentMenu -->

JO Functions > <BadgeClient /> jo.menu.setCurrentMenu() > Syntax

jo.menu.setCurrentMenu(id, keepHistoric, resetMenu)

JO Functions > <BadgeClient /> jo.menu.setCurrentMenu() > Parameters

id : string

ID of the menu to activate

keepHistoric : boolean <BadgeOptional />

Keep the menu navigation history <br> default: true

resetMenu : boolean <BadgeOptional />

Clear and redraw the menu before displaying <br> default: true

<!-- @include: ./slots/examples.md#client|jo.menu.setCurrentMenu -->

<!-- @include: ./slots/footers.md#client|jo.menu.setCurrentMenu -->


JO Functions > <BadgeClient /> jo.menu.show()

<!-- @include: ./slots/headers.md#client|jo.menu.show -->

Show or hide a menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.show -->

JO Functions > <BadgeClient /> jo.menu.show() > Syntax

jo.menu.show(show, keepInput, hideRadar, animation, hideCursor)

JO Functions > <BadgeClient /> jo.menu.show() > Parameters

show : boolean

Whether to show or hide the menu

keepInput : boolean <BadgeOptional />

Whether to keep game input controls active <br> default: true

hideRadar : boolean <BadgeOptional />

Whether to hide the radar when menu is shown <br> default: true

animation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

hideCursor : boolean <BadgeOptional />

Whether to hide the cursor <br> default: false

<!-- @include: ./slots/examples.md#client|jo.menu.show -->

<!-- @include: ./slots/footers.md#client|jo.menu.show -->


JO Functions > <BadgeClient /> jo.menu.softHide()

<!-- @include: ./slots/headers.md#client|jo.menu.softHide -->

A function to hide temporary the menu and do action <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.softHide -->

JO Functions > <BadgeClient /> jo.menu.softHide() > Syntax

jo.menu.softHide(cb, animation)

JO Functions > <BadgeClient /> jo.menu.softHide() > Parameters

cb : function

Action executed before show again the menu

animation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

<!-- @include: ./slots/examples.md#client|jo.menu.softHide -->

<!-- @include: ./slots/footers.md#client|jo.menu.softHide -->


JO Functions > <BadgeClient /> jo.menu.sort()

<!-- @include: ./slots/headers.md#client|jo.menu.sort -->

Sort menu items alphabetically by title using menu ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.sort -->

JO Functions > <BadgeClient /> jo.menu.sort() > Syntax

jo.menu.sort(id, first, last)

JO Functions > <BadgeClient /> jo.menu.sort() > Parameters

id : string

The menu ID

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.items

<!-- @include: ./slots/examples.md#client|jo.menu.sort -->

<!-- @include: ./slots/footers.md#client|jo.menu.sort -->


JO Functions > <BadgeClient /> jo.menu.updateItem()

<!-- @include: ./slots/headers.md#client|jo.menu.updateItem -->

Update a specific property of a menu item by menu ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.updateItem -->

JO Functions > <BadgeClient /> jo.menu.updateItem() > Syntax

jo.menu.updateItem(id, index, key, value)

JO Functions > <BadgeClient /> jo.menu.updateItem() > Parameters

id : string

The menu ID

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property

<!-- @include: ./slots/examples.md#client|jo.menu.updateItem -->

<!-- @include: ./slots/footers.md#client|jo.menu.updateItem -->


JO Functions > <BadgeClient /> jo.menu.updateLang()

<!-- @include: ./slots/headers.md#client|jo.menu.updateLang -->

Update menu language text <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.updateLang -->

JO Functions > <BadgeClient /> jo.menu.updateLang() > Syntax

jo.menu.updateLang(lang)

JO Functions > <BadgeClient /> jo.menu.updateLang() > Parameters

lang : table

List of translated strings

lang.of : string - The bottom right text displaying current item number <br> default : "%1 of %2" <BadgeOptional />

lang.selection : string - The "Selection" text <br> default : "Selection" <BadgeOptional />

lang.devise : string - The devise text <br> default : "$" <BadgeOptional />

lang.number : string - The number text <br> default : "Number %1" <BadgeOptional />

lang.free : string - The "Free" text <br> default : "Free" <BadgeOptional />

lang.variation : string - The variatio, text <br> default : "Variation" <BadgeOptional />

<!-- @include: ./slots/examples.md#client|jo.menu.updateLang -->

<!-- @include: ./slots/footers.md#client|jo.menu.updateLang -->


JO Functions > <BadgeClient /> jo.menu.updateVolume()

<!-- @include: ./slots/headers.md#client|jo.menu.updateVolume -->

Set the volume level for menu sound effects <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.updateVolume -->

JO Functions > <BadgeClient /> jo.menu.updateVolume() > Syntax

jo.menu.updateVolume(volume)

JO Functions > <BadgeClient /> jo.menu.updateVolume() > Parameters

volume : number

Volume of sound effects 0.0 to 1.0

<!-- @include: ./slots/examples.md#client|jo.menu.updateVolume -->

<!-- @include: ./slots/footers.md#client|jo.menu.updateVolume -->


JO Functions > <BadgeShared /> jo.menu.formatPrice()

<!-- @include: ./slots/headers.md#shared|jo.menu.formatPrice -->

A function to format a single price <br>

<!-- @include: ./slots/descriptions.md#shared|jo.menu.formatPrice -->

JO Functions > <BadgeShared /> jo.menu.formatPrice() > Syntax

jo.menu.formatPrice(price)

JO Functions > <BadgeShared /> jo.menu.formatPrice() > Parameters

price : table|integer|number

The price to format

JO Functions > <BadgeShared /> jo.menu.formatPrice() > Return Value

Type : table

The formatted price

<!-- @include: ./slots/examples.md#shared|jo.menu.formatPrice -->

<!-- @include: ./slots/footers.md#shared|jo.menu.formatPrice -->


JO Functions > <BadgeShared /> jo.menu.formatPrices()

<!-- @include: ./slots/headers.md#shared|jo.menu.formatPrices -->

A function to format price variations <br>

<!-- @include: ./slots/descriptions.md#shared|jo.menu.formatPrices -->

JO Functions > <BadgeShared /> jo.menu.formatPrices() > Syntax

jo.menu.formatPrices(prices)

JO Functions > <BadgeShared /> jo.menu.formatPrices() > Parameters

prices : table|integer|number

The prices to format

JO Functions > <BadgeShared /> jo.menu.formatPrices() > Return Value

Type : table

The formatted prices

<!-- @include: ./slots/examples.md#shared|jo.menu.formatPrices -->

<!-- @include: ./slots/footers.md#shared|jo.menu.formatPrices -->


JO Functions > <BadgeShared /> jo.menu.isPriceFree()

<!-- @include: ./slots/headers.md#shared|jo.menu.isPriceFree -->

Checks if a price is free <br>

<!-- @include: ./slots/descriptions.md#shared|jo.menu.isPriceFree -->

JO Functions > <BadgeShared /> jo.menu.isPriceFree() > Syntax

jo.menu.isPriceFree(price)

JO Functions > <BadgeShared /> jo.menu.isPriceFree() > Parameters

price : table|integer|number

The price to check

JO Functions > <BadgeShared /> jo.menu.isPriceFree() > Return Value

Type : boolean

Return true if the price is free

<!-- @include: ./slots/examples.md#shared|jo.menu.isPriceFree -->

<!-- @include: ./slots/footers.md#shared|jo.menu.isPriceFree -->


Variables

CurrentData > keys

CurrentData.menu : string

The unique ID of the menu

CurrentData.item : table

The item active in the menu

New assets

Add a new icon

Add you .png file in the nui\menu\assets\images\icons folder

Item variations

Sliders

4 types of sliders are available on the menu: Default, Grid, Palette & Switch.
You can use multiples sliders on the same item.
Use currentData.item.sliders[X].value to get the current value of the slider.
Here is an example of an item with sliders of the 4 types:
<img src="/images/previews/menu/preview_sliders.jpg" class="data-zoomable" data-zoomable style="height:20em"/>

Sliders > Default

The default slider based on the original game design. Useful to choose between item variations like clothes. The default slider{data-zoomable}

Sliders > Default > Syntax

{title = "", current = 1, values = {item1,item2,..}}

Sliders > Default > Keys

title : string

The label on the top of variations

current : integer

The current item selected

values : table

The table of item variations. 1 entry = 1 rectangle

Sliders > Default > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  sliders = {
    {
      title = 'Variations',
      current = 2,
      values = {
        "value1",
        { var = 4 },
        { yourKey = "your Value" },
        'value2',
        5,
        10,
      }
    },
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Sliders > Grid

The grid slider is useful to define a value between a min and max value.
You can use one or two dimensions of slider.
One dimension: The grid slider one dimension{data-zoomable} Two dimensions: The grid slider two dimensions{data-zoomable}

:::tip To get the values of the slider, .value is a table with two arguments:
currentData.item.sliders[X].value[1] for the horizontal axe (or for one dimension slider)
currentData.item.sliders[X].value[2] for the vertical axe :::

Sliders > Grid > Syntax

{type = "grid", labels = {'left','right','up','down'}, values = {
  {current = 0.5,max = 1.0, min = -1.0, gap = 0.01},
  {current = 0.5,max = 10.0, min = 0.0, gap = 0.01}, --for two dimensions
}}

Sliders > Grid > Keys

type : string

The type of slider

labels : table

The 4 labels in the order : left, right, top, bottom

values : table

The slider definitions.
1 entry = 1 dimension slider
2 entries = 2 dimensions sliders values[x].current : float - the current value of the slider values[x].min : float - the minimal value (cursor on the full left/top) values[x].max : float - the minimal value (cursor on the full right/bottom)

Sliders > Grid > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  sliders = {
    {
      type = "grid",
      labels = { 'left', 'right', 'up', 'down' },
      values = {
        { current = 0.5, max = 1.0,  min = -1.0 },
        { current = 0.5, max = 10.0, min = 0.0 }, --for two dimensions
      }
    },
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Sliders > Palette

The palette slider is useful to select a color.
The palette slider{data-zoomable}

Sliders > Palette > Syntax

{type = "palette", title = "tint", tint = "tint_makeup", max = 63, current = 14}

Sliders > Palette > Keys

type : string

The type of slider

title : table

The top label on the slider

tint : string

The name of the gradient :
"tint_generic_clean", "tint_hair", "tint_horse", "tint_horse_leather", "tint_leather" & "tint_makeup"

max : integer

The number of varations

current : integer

The current variation

Sliders > Palette > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  sliders = {
    { type = "palette", title = "tint", tint = "tint_makeup", max = 63, current = 14 }
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Sliders > Switch

The switch slider is display on the right of the item label.
The switch slider{data-zoomable}

Sliders > Switch > Syntax

{type = "switch", current = 1, values = {
  {label = "", data = {}},
  {label = "", data = {}}
}}

Sliders > Switch > Keys

type : string

The type of slider

current : integer

The current variation

values : table

The list of variations
values[x].label is the label displayed

Sliders > Switch > Example

local menu = jo.menu.create('menu1',{})
menu:addItem({
  title = "Item",
  sliders = {
    { type = "switch", current = 1, values = {
      {label = "value 1", myKey = 4},
      {label = "value 2", data = "what you want"}
    }
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Statistics

Statistics table is displayed at the bottom of the menu. 5 types of statistics are available: Bar, Bar-style, Icon, Texts and Weapon-bar
Multiple statistics can be use for the same item.
Here is an example of an item with 5 statistics of the 5 types: <img src="/images/previews/menu/preview_statistics.jpg" class="data-zoomable" data-zoomable style="height:20em"/>

Statistics > Bar

A statistic with 10 bars Statistic bar preview{data-zoomable}

Statistics > Bar > Syntax

{label = "", type = "bar", value = {current,max}}

Statistics > Bar > Keys

label : string

the left label

type : string

value : table

For the left to the right, current are white, max are grey, all the rest is dark grey
value.current : integer (0<>10 - the number of white bar
value.max : integer (0<>10 - the number of grey bar

Statistics > Bar > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  statistics = {
    { label = "The label", type = "bar", value = { 3, 8 } }
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Statistics > Bar-style

A statistic with unlimted bar defined with CSS classes Statistic bar preview with CSS classes{data-zoomable}

Statistics > Bar-style > Syntax

{label = "", type = "bar-style", value = {'','',''}}

Statistics > Bar-style > Keys

label : string

the left label

type : string

value : table

A list of string to define the CSS classes of bar, 1 string = 1 bar
If the string is empty, the bar is dark grey. CSS classes:

  • active : Opacity = 1
  • fgold : Gold
  • fred : Red
  • possible : Opacity = 0.5

CSS classes can be combinated

Statistics > Bar-style > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  statistics = {
    {
      label = "The label",
      type = "bar-style",
      value = {
        "active",      --the 1st bar: opacity = 1
        "active fgold", --the 2nd bar: opacity = 1 + gold
        "active fred", --the 3rd bar: opacity = 1 + red
        "possible fred", --the 4th bar: opacity = 0.5 + red
        "possible",    --the 4th bar: opacity = 0.5
        "",            --the 5th bar: opacity = 0.2
      }
    },
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Statistics > Icon

A statistic with icons on the right Statistics with icons{data-zoomable}

Statistics > Icon > Syntax

{label = "", type = "icon", value = {{icon = '', opacity = 1.0}}}

Statistics > Icon > Keys

label : string

the left label

type : string

value : table

A list of table to define the icon from left to right, 1 table = 1 icon
icon : string - Icon filename from nui\menu\assets\images\icons\ folder
opacity : float (0.0<>1.0) - The opacity of the icon

Statistics > Icon > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  statistics = {
    {
      label = "The label",
      type = "icon",
      value = {
        { icon = "player_health", opacity = 1 }, --the 1st icon
        { icon = "player_health", opacity = 0.75 }, --the 2nd icon
        { icon = "player_health", opacity = 0.3 } --the 3rd icon
      }
    },
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Statistics > Texts

Basic statistic with two labels Basic statistics{data-zoomable}

Statistics > Texts > Syntax

{label = "", value = ""}

Statistics > Texts > Keys

label : string

The left label

value : string

The right label

Statistics > Texts > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  statistics = {
    { label = "The label", value = "The value" }
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Statistics > Weapon-bar

A statistic with the weapon bar design. Useful to display a percent of completion Statistics with weapon bar design{data-zoomable}

Statistics > Weapon-bar > Syntax

{label = "", type="weapon-bar", value = {current,max}}

Statistics > Weapon-bar > Keys

label : string

The left label

type : string

value : table

The percent of completion is calculated by value.current\value.max
value.current : float - the current value of the statistic
value.max : float - the max value the statistic can reach

Statistics > Weapon-bar > Example

local menu = jo.menu.create('menu1', {})
menu:addItem({
  title = "Item",
  statistics = {
    { label = "The label", type = "weapon-bar", value = { 60, 100 } }
  }
})
menu:send()
jo.menu.setCurrentMenu('menu1')
jo.menu.show(true)

Constructor > <Badge type="client" text="Client" /> jo.menu.create()

<!-- @include: ./slots/headers.md#client|jo.menu.create -->

Create a new menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.create -->

Constructor > <Badge type="client" text="Client" /> jo.menu.create() > Syntax

jo.menu.create(id, data)

Constructor > <Badge type="client" text="Client" /> jo.menu.create() > Parameters

id : string

Unique ID of the menu

data : table <BadgeOptional />

Menu configuration data

data.type : string - The type of menu tile or list <br> default tile

data.title : string - The big title of the menu The menu title <BadgeOptional />

data.subtitle : string - The subtitle of the menu The subtitle

data.numberOnScreen : integer - Only for list menu, Maximum number of items visibles at the same time <br> default : 8 <BadgeOptional />

data.numberOnLine : integer - Only for tile menu, Maximum number of items visibles at the same time <br> default : 4 <BadgeOptional />

data.numberLineOnScreen : integer - Only for tile menu, Maximum number of lines visibles at the same time <br> default : 6 <BadgeOptional />

data.distanceToClose : float - Distance at which the menu will self close if the player is moving away <br> default: false

data.displayBackButton : boolean - Whether to display the back button <br> default: false

data.onEnter : function - Fired when the menu is opened <BadgeOptional />

data.onBack : function - Fired when the backspace/Escape is pressed <BadgeOptional />

data.onExit : function - Fired when the menu is exited <BadgeOptional />

data.onTick : function - Fired every tick <BadgeOptional />

Constructor > <Badge type="client" text="Client" /> jo.menu.create() > Return Value

Type : MenuClass

The newly created menu object

<!-- @include: ./slots/examples.md#client|jo.menu.create -->

<!-- @include: ./slots/footers.md#client|jo.menu.create -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem()

<!-- @include: ./slots/headers.md#client|MenuClass:addItem -->

Add an item to a menu <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:addItem -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Syntax

MenuClass:addItem(index, item)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Parameters

index : integer|table

Position index or item table if used as single parameter

[item](#item-methods) : table <BadgeOptional />

The item to add - if not provided, p is used as the item

[item](#item-methods).title : string - The item label

[item](#item-methods).child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

[item](#item-methods).visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

[item](#item-methods).data : table - Variable to store custom data in the item <BadgeOptional />

[item](#item-methods).description : string - Description text for the item <BadgeOptional />

[item](#item-methods).prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

[item](#item-methods).icon : string - The left icon filename from nui\menu\assets\images\icons folder, or full image URL Icon <BadgeOptional />

[item](#item-methods).iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

[item](#item-methods).iconClass : string - CSS class for the icon <BadgeOptional />

[item](#item-methods).price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

[item](#item-methods).price.money : number - The price in $ <BadgeOptional />

[item](#item-methods).price.gold : number - The price in gold <BadgeOptional />

[item](#item-methods).priceTitle : string - Replace the "Price" label <BadgeOptional />

[item](#item-methods).priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

[item](#item-methods).statistics : table - List of statistics to display for the item <BadgeOptional />

[item](#item-methods).disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

[item](#item-methods).textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

[item](#item-methods).previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

[item](#item-methods).sliders : table - List of sliders for the item <BadgeOptional />

[item](#item-methods).onActive : function - Fired when the item is selected <BadgeOptional />

[item](#item-methods).onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

[item](#item-methods).onChange : function - Fired when a slider value changes <BadgeOptional />

[item](#item-methods).onExit : function - Fired when the item is exited <BadgeOptional />

[item](#item-methods).onTick : function - Fired every tick <BadgeOptional />

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Return Value

Type : MenuItemClass

The added item

<!-- @include: ./slots/examples.md#client|MenuClass:addItem -->

<!-- @include: ./slots/footers.md#client|MenuClass:addItem -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteItem()

<!-- @include: ./slots/headers.md#client|MenuClass:deleteItem -->

<!-- @include: ./slots/descriptions.md#client|MenuClass:deleteItem -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteItem() > Syntax

MenuClass:deleteItem(index)

<!-- @include: ./slots/examples.md#client|MenuClass:deleteItem -->

<!-- @include: ./slots/footers.md#client|MenuClass:deleteItem -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue()

<!-- @include: ./slots/headers.md#client|MenuClass:deleteValue -->

Delete a specific property of a menu. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:deleteValue -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue() > Syntax

MenuClass:deleteValue(keys)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value

<!-- @include: ./slots/examples.md#client|MenuClass:deleteValue -->

<!-- @include: ./slots/footers.md#client|MenuClass:deleteValue -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:push()

<!-- @include: ./slots/headers.md#client|MenuClass:push -->

Push the updated values to the NUI layer <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:push -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:push() > Syntax

MenuClass:push()

<!-- @include: ./slots/examples.md#client|MenuClass:push -->

<!-- @include: ./slots/footers.md#client|MenuClass:push -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:refresh()

<!-- @include: ./slots/headers.md#client|MenuClass:refresh -->

Refresh all the menu without changing the current state <br> Used when you want rebuild the menu <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:refresh -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:refresh() > Syntax

MenuClass:refresh()

<!-- @include: ./slots/examples.md#client|MenuClass:refresh -->

<!-- @include: ./slots/footers.md#client|MenuClass:refresh -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem()

<!-- @include: ./slots/headers.md#client|MenuClass:removeItem -->

Remove an item from a menu by its index. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:removeItem -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem() > Syntax

MenuClass:removeItem(index)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem() > Parameters

index : integer

The index of the item to remove

<!-- @include: ./slots/examples.md#client|MenuClass:removeItem -->

<!-- @include: ./slots/footers.md#client|MenuClass:removeItem -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:reset()

<!-- @include: ./slots/headers.md#client|MenuClass:reset -->

Reset the menu to its initial state <br> Moves the cursor back to the first item <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:reset -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:reset() > Syntax

MenuClass:reset()

<!-- @include: ./slots/examples.md#client|MenuClass:reset -->

<!-- @include: ./slots/footers.md#client|MenuClass:reset -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:send()

<!-- @include: ./slots/headers.md#client|MenuClass:send -->

Send the menu data to the NUI layer <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:send -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:send() > Syntax

MenuClass:send()

<!-- @include: ./slots/examples.md#client|MenuClass:send -->

<!-- @include: ./slots/footers.md#client|MenuClass:send -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex()

<!-- @include: ./slots/headers.md#client|MenuClass:setCurrentIndex -->

Change the current active item index <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:setCurrentIndex -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex() > Syntax

MenuClass:setCurrentIndex(index)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex() > Parameters

index : integer

The item index to switch to

<!-- @include: ./slots/examples.md#client|MenuClass:setCurrentIndex -->

<!-- @include: ./slots/footers.md#client|MenuClass:setCurrentIndex -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort()

<!-- @include: ./slots/headers.md#client|MenuClass:sort -->

Sort menu items alphabetically by title <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:sort -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort() > Syntax

MenuClass:sort(first, last)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort() > Parameters

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.[item](#item-methods)s

<!-- @include: ./slots/examples.md#client|MenuClass:sort -->

<!-- @include: ./slots/footers.md#client|MenuClass:sort -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem()

<!-- @include: ./slots/headers.md#client|MenuClass:updateItem -->

Update a specific property of a menu item <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:updateItem -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem() > Syntax

MenuClass:updateItem(index, key, value)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem() > Parameters

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property

<!-- @include: ./slots/examples.md#client|MenuClass:updateItem -->

<!-- @include: ./slots/footers.md#client|MenuClass:updateItem -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue()

<!-- @include: ./slots/headers.md#client|MenuClass:updateValue -->

Update a specific property of a menu. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:updateValue -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Syntax

MenuClass:updateValue(keys, value)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Parameters

keys : string|table

The list of property name to access to the value

value : any

The new value

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Return Value

Type : boolean

true if the update was successful, false otherwise

<!-- @include: ./slots/examples.md#client|MenuClass:updateValue -->

<!-- @include: ./slots/footers.md#client|MenuClass:updateValue -->


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:use()

<!-- @include: ./slots/headers.md#client|MenuClass:use -->

Set this menu as the current active menu <br>

<!-- @include: ./slots/descriptions.md#client|MenuClass:use -->

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:use() > Syntax

MenuClass:use(keepHistoric, resetMenu)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:use() > Parameters

keepHistoric : boolean <BadgeOptional />

Whether to keep navigation history <br> default: true

resetMenu : boolean <BadgeOptional />

Whether to reset the menu state <br> default: true

<!-- @include: ./slots/examples.md#client|MenuClass:use -->

<!-- @include: ./slots/footers.md#client|MenuClass:use -->

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue()

<!-- @include: ./slots/headers.md#client|MenuItem:deleteValue -->

Delete a specific property of a menu item. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuItem:deleteValue -->

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue() > Syntax

MenuItem:deleteValue(keys)

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value

<!-- @include: ./slots/examples.md#client|MenuItem:deleteValue -->

<!-- @include: ./slots/footers.md#client|MenuItem:deleteValue -->


MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu()

<!-- @include: ./slots/headers.md#client|MenuItem:getParentMenu -->

Get the parent menu of the item <br>

<!-- @include: ./slots/descriptions.md#client|MenuItem:getParentMenu -->

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu() > Syntax

MenuItem:getParentMenu()

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu() > Return Value

Type : MenuClass

The parent menu

<!-- @include: ./slots/examples.md#client|MenuItem:getParentMenu -->

<!-- @include: ./slots/footers.md#client|MenuItem:getParentMenu -->


MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:updateValue()

<!-- @include: ./slots/headers.md#client|MenuItem:updateValue -->

Update a specific property of a menu item. Requires MenuClass:push() to be called to apply the changes <br>

<!-- @include: ./slots/descriptions.md#client|MenuItem:updateValue -->

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:updateValue() > Syntax

MenuItem:updateValue(keys, value)

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:updateValue() > Parameters

keys : string|table

The property name to update

value : any

The new value for the property

<!-- @include: ./slots/examples.md#client|MenuItem:updateValue -->

<!-- @include: ./slots/footers.md#client|MenuItem:updateValue -->

item Methods > <Badge type="client" text="Client" /> item:getParentMenu()

<!-- @include: ./slots/headers.md#client|item:getParentMenu -->

<!-- @include: ./slots/descriptions.md#client|item:getParentMenu -->

item Methods > <Badge type="client" text="Client" /> item:getParentMenu() > Syntax

item:getParentMenu()

<!-- @include: ./slots/examples.md#client|item:getParentMenu -->

<!-- @include: ./slots/footers.md#client|item:getParentMenu -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem()

<!-- @include: ./slots/headers.md#client|jo.menu.addItem -->

Add an item to a menu by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.addItem -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem() > Syntax

jo.menu.addItem(id, p, item)

JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem() > Parameters

id : string

The menu ID

p : integer|table

Position index or item table if used as single parameter

[item](#item-methods) : table <BadgeOptional />

The item to add - if not provided, p is used as the item

[item](#item-methods).title : string - The item label

[item](#item-methods).child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

[item](#item-methods).visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

[item](#item-methods).data : table - Variable to store custom data in the item <BadgeOptional />

[item](#item-methods).description : string - Description text for the item <BadgeOptional />

[item](#item-methods).prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

[item](#item-methods).icon : string - The left icon filename from nui\menu\assets\images\icons folder Icon <BadgeOptional />

[item](#item-methods).iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

[item](#item-methods).iconClass : string - CSS class for the icon <BadgeOptional />

[item](#item-methods).price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

[item](#item-methods).price.money : number - The price in $ <BadgeOptional />

[item](#item-methods).price.gold : number - The price in gold <BadgeOptional />

[item](#item-methods).priceTitle : string - Replace the "Price" label <BadgeOptional />

[item](#item-methods).priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

[item](#item-methods).statistics : table - List of statistics to display for the item <BadgeOptional />

[item](#item-methods).disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

[item](#item-methods).textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

[item](#item-methods).previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

[item](#item-methods).sliders : table - List of sliders for the item <BadgeOptional />

[item](#item-methods).onActive : function - Fired when the item is selected <BadgeOptional />

[item](#item-methods).onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

[item](#item-methods).onChange : function - Fired when a slider value changes <BadgeOptional />

[item](#item-methods).onExit : function - Fired when the item is exited <BadgeOptional />

<!-- @include: ./slots/examples.md#client|jo.menu.addItem -->

<!-- @include: ./slots/footers.md#client|jo.menu.addItem -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist()

<!-- @include: ./slots/headers.md#client|jo.menu.createIfNotExist -->

Create a new menu if it doesn't exist <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.createIfNotExist -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist() > Syntax

jo.menu.createIfNotExist(id, data)

JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist() > Parameters

id : string

Unique ID of the menu

data : table <BadgeOptional />

Menu configuration data

JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist() > Return Value

Type : boolean

Returns true if the menu was created

<!-- @include: ./slots/examples.md#client|jo.menu.createIfNotExist -->

<!-- @include: ./slots/footers.md#client|jo.menu.createIfNotExist -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.delete()

<!-- @include: ./slots/headers.md#client|jo.menu.delete -->

Delete a menu from memory <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.delete -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.delete() > Syntax

jo.menu.delete(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.delete() > Parameters

id : string

The menu ID to delete

<!-- @include: ./slots/examples.md#client|jo.menu.delete -->

<!-- @include: ./slots/footers.md#client|jo.menu.delete -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.displayLoader()

<!-- @include: ./slots/headers.md#client|jo.menu.displayLoader -->

A function to display the loader <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.displayLoader -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.displayLoader() > Syntax

jo.menu.displayLoader(value)

JO Functions > <Badge type="client" text="Client" /> jo.menu.displayLoader() > Parameters

value : boolean <BadgeOptional />

Whether to display the loader <br> default: true

<!-- @include: ./slots/examples.md#client|jo.menu.displayLoader -->

<!-- @include: ./slots/footers.md#client|jo.menu.displayLoader -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange()

<!-- @include: ./slots/headers.md#client|jo.menu.doesActiveButtonChange -->

Check if the active button has changed since last update <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.doesActiveButtonChange -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange() > Syntax

jo.menu.doesActiveButtonChange()

JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange() > Return Value

Type : boolean

Returns true if the active button has changed

<!-- @include: ./slots/examples.md#client|jo.menu.doesActiveButtonChange -->

<!-- @include: ./slots/footers.md#client|jo.menu.doesActiveButtonChange -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent()

<!-- @include: ./slots/headers.md#client|jo.menu.fireAllLevelsEvent -->

Fire an event across all menu levels (current menu and current item) <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.fireAllLevelsEvent -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent() > Syntax

jo.menu.fireAllLevelsEvent(eventName, ...)

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent() > Parameters

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handlers

<!-- @include: ./slots/examples.md#client|jo.menu.fireAllLevelsEvent -->

<!-- @include: ./slots/footers.md#client|jo.menu.fireAllLevelsEvent -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent()

<!-- @include: ./slots/headers.md#client|jo.menu.fireEvent -->

Fire an event for a specific menu item <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.fireEvent -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent() > Syntax

jo.menu.fireEvent(item, eventName, ...)

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent() > Parameters

[item](#item-methods) : table

The item to trigger the event on

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handler

<!-- @include: ./slots/examples.md#client|jo.menu.fireEvent -->

<!-- @include: ./slots/footers.md#client|jo.menu.fireEvent -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.forceBack()

<!-- @include: ./slots/headers.md#client|jo.menu.forceBack -->

Force the menu to go back to the previous menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.forceBack -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.forceBack() > Syntax

jo.menu.forceBack()

<!-- @include: ./slots/examples.md#client|jo.menu.forceBack -->

<!-- @include: ./slots/footers.md#client|jo.menu.forceBack -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.get()

<!-- @include: ./slots/headers.md#client|jo.menu.get -->

Get a menu instance by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.get -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Syntax

jo.menu.get(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Parameters

id : string

The menu ID

JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Return Value

Type : MenuClass

The menu object

<!-- @include: ./slots/examples.md#client|jo.menu.get -->

<!-- @include: ./slots/footers.md#client|jo.menu.get -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentData -->

Get data about the current menu state <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentData -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData() > Syntax

jo.menu.getCurrentData()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData() > Return Value

Type : table

Current menu data including menu ID and selected item

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentData -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentData -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentIndex -->

A function to get the current index <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentIndex -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex() > Syntax

jo.menu.getCurrentIndex()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex() > Return Value

Type : integer

The index of the current item

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentIndex -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentIndex -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentItem -->

Get the currently selected menu item <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentItem -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem() > Syntax

jo.menu.getCurrentItem()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem() > Return Value

Type : table

The currently selected item

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentItem -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentItem -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenu()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentMenu -->

Get the currently active menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentMenu -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenu() > Syntax

jo.menu.getCurrentMenu()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenu() > Return Value

Type : MenuClass

The currently active menu

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentMenu -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentMenu -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId()

<!-- @include: ./slots/headers.md#client|jo.menu.getCurrentMenuId -->

A function to get the current menu id <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getCurrentMenuId -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId() > Syntax

jo.menu.getCurrentMenuId()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId() > Return Value

Type : string

The id of the current menu

<!-- @include: ./slots/examples.md#client|jo.menu.getCurrentMenuId -->

<!-- @include: ./slots/footers.md#client|jo.menu.getCurrentMenuId -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData()

<!-- @include: ./slots/headers.md#client|jo.menu.getPreviousData -->

Get data about the previous menu state <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.getPreviousData -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData() > Syntax

jo.menu.getPreviousData()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData() > Return Value

Type : table

Previous menu data including menu ID and selected item

<!-- @include: ./slots/examples.md#client|jo.menu.getPreviousData -->

<!-- @include: ./slots/footers.md#client|jo.menu.getPreviousData -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.hideLoader()

<!-- @include: ./slots/headers.md#client|jo.menu.hideLoader -->

A function to hide the loader <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.hideLoader -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.hideLoader() > Syntax

jo.menu.hideLoader()

<!-- @include: ./slots/examples.md#client|jo.menu.hideLoader -->

<!-- @include: ./slots/footers.md#client|jo.menu.hideLoader -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu()

<!-- @include: ./slots/headers.md#client|jo.menu.isCurrentMenu -->

A function to know if the menu is the current one <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.isCurrentMenu -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Syntax

jo.menu.isCurrentMenu(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Parameters

id : string

The menu id

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Return Value

Type : boolean

<!-- @include: ./slots/examples.md#client|jo.menu.isCurrentMenu -->

<!-- @include: ./slots/footers.md#client|jo.menu.isCurrentMenu -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist()

<!-- @include: ./slots/headers.md#client|jo.menu.isExist -->

Check if a menu exist <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.isExist -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Syntax

jo.menu.isExist(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Parameters

id : string

the menu ID

JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Return Value

Type : boolean

Returns true if the menu exists

<!-- @include: ./slots/examples.md#client|jo.menu.isExist -->

<!-- @include: ./slots/footers.md#client|jo.menu.isExist -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen()

<!-- @include: ./slots/headers.md#client|jo.menu.isOpen -->

Check if any menu is currently open <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.isOpen -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen() > Syntax

jo.menu.isOpen()

JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen() > Return Value

Type : boolean

Returns true if a menu is open

<!-- @include: ./slots/examples.md#client|jo.menu.isOpen -->

<!-- @include: ./slots/footers.md#client|jo.menu.isOpen -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.isSoftHidden()

<!-- @include: ./slots/headers.md#client|jo.menu.isSoftHidden -->

<!-- @include: ./slots/descriptions.md#client|jo.menu.isSoftHidden -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.isSoftHidden() > Syntax

jo.menu.isSoftHidden()

<!-- @include: ./slots/examples.md#client|jo.menu.isSoftHidden -->

<!-- @include: ./slots/footers.md#client|jo.menu.isSoftHidden -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler()

<!-- @include: ./slots/headers.md#client|jo.menu.missingMenuHandler -->

Register a handler for missing menu error <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.missingMenuHandler -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler() > Syntax

jo.menu.missingMenuHandler(id, callback)

JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler() > Parameters

id : string

The menu ID

callback : function

The handler function

<!-- @include: ./slots/examples.md#client|jo.menu.missingMenuHandler -->

<!-- @include: ./slots/footers.md#client|jo.menu.missingMenuHandler -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange()

<!-- @include: ./slots/headers.md#client|jo.menu.onChange -->

Register a callback function for menu change events <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.onChange -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange() > Syntax

jo.menu.onChange(cb)

JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange() > Parameters

cb : function

The callback function to register

<!-- @include: ./slots/examples.md#client|jo.menu.onChange -->

<!-- @include: ./slots/footers.md#client|jo.menu.onChange -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.playAudio()

<!-- @include: ./slots/headers.md#client|jo.menu.playAudio -->

A function to play a NUI sound <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.playAudio -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.playAudio() > Syntax

jo.menu.playAudio(sound)

JO Functions > <Badge type="client" text="Client" /> jo.menu.playAudio() > Parameters

sound : string

<!-- @include: ./slots/examples.md#client|jo.menu.playAudio -->

<!-- @include: ./slots/footers.md#client|jo.menu.playAudio -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.refresh()

<!-- @include: ./slots/headers.md#client|jo.menu.refresh -->

Refresh a menu by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.refresh -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.refresh() > Syntax

jo.menu.refresh(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.refresh() > Parameters

id : string

The menu ID to refresh

<!-- @include: ./slots/examples.md#client|jo.menu.refresh -->

<!-- @include: ./slots/footers.md#client|jo.menu.refresh -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.reset()

<!-- @include: ./slots/headers.md#client|jo.menu.reset -->

Reset a menu by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.reset -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.reset() > Syntax

jo.menu.reset(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.reset() > Parameters

id : string

The menu ID to reset

<!-- @include: ./slots/examples.md#client|jo.menu.reset -->

<!-- @include: ./slots/footers.md#client|jo.menu.reset -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents()

<!-- @include: ./slots/headers.md#client|jo.menu.runRefreshEvents -->

A function to fire menu and items events <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.runRefreshEvents -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents() > Syntax

jo.menu.runRefreshEvents(menuEvent, itemEvent)

JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents() > Parameters

menuEvent : boolean <BadgeOptional />

Whether to run menu events

[item](#item-methods)Event : boolean <BadgeOptional />

Whether to run item events

<!-- @include: ./slots/examples.md#client|jo.menu.runRefreshEvents -->

<!-- @include: ./slots/footers.md#client|jo.menu.runRefreshEvents -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.send()

<!-- @include: ./slots/headers.md#client|jo.menu.send -->

Send a menu to the NUI layer by its ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.send -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.send() > Syntax

jo.menu.send(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.send() > Parameters

id : string

The menu ID

<!-- @include: ./slots/examples.md#client|jo.menu.send -->

<!-- @include: ./slots/footers.md#client|jo.menu.send -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.set()

<!-- @include: ./slots/headers.md#client|jo.menu.set -->

Set or replace a menu instance <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.set -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.set() > Syntax

jo.menu.set(id, menu)

JO Functions > <Badge type="client" text="Client" /> jo.menu.set() > Parameters

id : string

The menu ID

menu : MenuClass

The menu object to set

<!-- @include: ./slots/examples.md#client|jo.menu.set -->

<!-- @include: ./slots/footers.md#client|jo.menu.set -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu()

<!-- @include: ./slots/headers.md#client|jo.menu.setCurrentMenu -->

Set a menu as the current active menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.setCurrentMenu -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu() > Syntax

jo.menu.setCurrentMenu(id, keepHistoric, resetMenu)

JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu() > Parameters

id : string

ID of the menu to activate

keepHistoric : boolean <BadgeOptional />

Keep the menu navigation history <br> default: true

resetMenu : boolean <BadgeOptional />

Clear and redraw the menu before displaying <br> default: true

<!-- @include: ./slots/examples.md#client|jo.menu.setCurrentMenu -->

<!-- @include: ./slots/footers.md#client|jo.menu.setCurrentMenu -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.show()

<!-- @include: ./slots/headers.md#client|jo.menu.show -->

Show or hide a menu <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.show -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Syntax

jo.menu.show(show, keepInput, hideRadar, playMenuAnimation, hideCursor)

JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Parameters

show : boolean

Whether to show or hide the menu

keepInput : boolean <BadgeOptional />

Whether to keep game input controls active <br> default: true

hideRadar : boolean <BadgeOptional />

Whether to hide the radar when menu is shown <br> default: true

playMenuAnimation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

hideCursor : boolean <BadgeOptional />

Whether to hide the cursor <br> default: false

<!-- @include: ./slots/examples.md#client|jo.menu.show -->

<!-- @include: ./slots/footers.md#client|jo.menu.show -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide()

<!-- @include: ./slots/headers.md#client|jo.menu.softHide -->

A function to hide temporary the menu and do action <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.softHide -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Syntax

jo.menu.softHide(cb, playMenuAnimation, keepBackground)

JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Parameters

cb : function

Action executed before show again the menu

playMenuAnimation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

<!-- @include: ./slots/examples.md#client|jo.menu.softHide -->

<!-- @include: ./slots/footers.md#client|jo.menu.softHide -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.sort()

<!-- @include: ./slots/headers.md#client|jo.menu.sort -->

Sort menu items alphabetically by title using menu ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.sort -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.sort() > Syntax

jo.menu.sort(id, first, last)

JO Functions > <Badge type="client" text="Client" /> jo.menu.sort() > Parameters

id : string

The menu ID

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.[item](#item-methods)s

<!-- @include: ./slots/examples.md#client|jo.menu.sort -->

<!-- @include: ./slots/footers.md#client|jo.menu.sort -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem()

<!-- @include: ./slots/headers.md#client|jo.menu.updateItem -->

Update a specific property of a menu item by menu ID <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.updateItem -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem() > Syntax

jo.menu.updateItem(id, index, key, value)

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem() > Parameters

id : string

The menu ID

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property

<!-- @include: ./slots/examples.md#client|jo.menu.updateItem -->

<!-- @include: ./slots/footers.md#client|jo.menu.updateItem -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateLang()

<!-- @include: ./slots/headers.md#client|jo.menu.updateLang -->

Update menu language text <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.updateLang -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateLang() > Syntax

jo.menu.updateLang(lang)

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateLang() > Parameters

lang : table

List of translated strings

lang.of : string - The bottom right text displaying current item number <br> default : "%1 of %2" <BadgeOptional />

lang.selection : string - The "Selection" text <br> default : "Selection" <BadgeOptional />

lang.devise : string - The devise text <br> default : "$" <BadgeOptional />

lang.number : string - The number text <br> default : "Number %1" <BadgeOptional />

lang.free : string - The "Free" text <br> default : "Free" <BadgeOptional />

lang.variation : string - The variatio, text <br> default : "Variation" <BadgeOptional />

<!-- @include: ./slots/examples.md#client|jo.menu.updateLang -->

<!-- @include: ./slots/footers.md#client|jo.menu.updateLang -->


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateVolume()

<!-- @include: ./slots/headers.md#client|jo.menu.updateVolume -->

Set the volume level for menu sound effects <br>

<!-- @include: ./slots/descriptions.md#client|jo.menu.updateVolume -->

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateVolume() > Syntax

jo.menu.updateVolume(volume)

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateVolume() > Parameters

volume : number

Volume of sound effects 0.0 to 1.0

<!-- @include: ./slots/examples.md#client|jo.menu.updateVolume -->

<!-- @include: ./slots/footers.md#client|jo.menu.updateVolume -->


Variables

Back to documentation