Skip to content

Commit

Permalink
[add] the menu property description
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiipylypchuk1991 committed Feb 18, 2025
1 parent ad88d47 commit 6b2aa46
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/api/api_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ description: You can have an API overview of the DHTMLX JavaScript To Do List li
| [](api/configs/drag_config.md) | @getshort(api/configs/drag_config.md) |
| [](api/configs/id_config.md) | @getshort(api/configs/id_config.md) |
| [](api/configs/locale_config.md) | @getshort(api/configs/locale_config.md) |
| [](api/configs/menu_config.md) | @getshort(api/configs/menu_config.md) |
| [](api/configs/priorities_config.md) | @getshort(api/configs/priorities_config.md) |
| [](api/configs/projects_config.md) | @getshort(api/configs/projects_config.md) |
| [](api/configs/readonly_config.md) | @getshort(api/configs/readonly_config.md) |
Expand Down
98 changes: 98 additions & 0 deletions docs/api/configs/menu_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
sidebar_label: menu
title: menu Config
description: You can learn about the menu config in the documentation of the DHTMLX JavaScript To Do List library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX To Do List.
---

# menu

### Description

@short: Optional. Specifies the context menu visibility (if boolean) or configuration parameters (if function)

### Usage

~~~js
menu?: boolean;
// or
menu?: function(config: object);
~~~

#### Show or Hide Context Menu

If you want to *hide* the context menu, set the `menu` config to `false`. To make the default context menu visible, set the `menu` config to `true`.

~~~js
menu: true // display the default context menu

// or

menu: false // hide the context menu
~~~

#### Modify Context Menu

If you want to *modify* a context menu, set the `menu` config to a callback that takes the `config` object as a parameter. The `config` object may have the following structure:

~~~js
config: {
store: object,
type: "user" | "toolbar" | "task",
id?: string | number,
source?: (string | number)[]
};
~~~

**Parameters**

- `store` - (required) the readonly DataStore, that should be passed to the `getMenuOptions()` method
- `type` - (required) the type of the context menu. Here you can specify one of the following values:
- `"user"` - the context menu related to users
- `"toolbar"` - the context menu related to toolbar
- `"task"` - the context menu related to tasks
- `id` - (optional|required) the ID of the project. This parameter is required if `type: "toolbar"`
- `source` - (optional|required) an array that include the IDs of tasks. This parameter is required if `type: "toolbar"`

**Returns**

The callback should return one of the following values:

- `boolean` - `true` to display a default context menu; `false` to hide context menu
- `null` - ?
- `object[]` - the array of objects that store data for context menu items. Each object may have the following structure:

~~~js
{
id: string | number,
type?: string,
icon?: string,
label?: string,
hotkey?: string,
value?: Date,
data?: object[],
handler?: function
}
~~~

- `id` - (required) the ID of the menu item
- `icon` - (optional) the icon for the menu item (by default taken from the **wxi** font)
- `label` - (optional) the text for the menu item
- `hotkey` - (optional) a hotkey for the action from this menu item
- `value` - (optional) the due date, valid for "datepicker"
- `data` - (optional) the array of objects that store subitems of the menu item
- `handler` - (option) the handler that allows you to perform an action for a custom menu item
- `type` - (optional) the menu item type. Here you can specify the following types:
- `"item"` -
- `"separator"` -
- `"datepicker"` -
- `"user"` -
- `"priority"` -

### Example

~~~js {}
...
~~~

**Related articles:**
...
1 change: 1 addition & 0 deletions docs/api/overview/configs_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: You can explore the API properties of To Do List in the documentati
| [](../configs/drag_config.md) | @getshort(../configs/drag_config.md) |
| [](../configs/id_config.md) | @getshort(../configs/id_config.md) |
| [](../configs/locale_config.md) | @getshort(../configs/locale_config.md) |
| [](../configs/menu_config.md) | @getshort(../configs/menu_config.md) |
| [](../configs/priorities_config.md) | @getshort(../configs/priorities_config.md) |
| [](../configs/projects_config.md) | @getshort(../configs/projects_config.md) |
| [](../configs/readonly_config.md) | @getshort(../configs/readonly_config.md) |
Expand Down
8 changes: 8 additions & 0 deletions docs/whats_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ description: You can learn a new information about DHTMLX JavaScript To Do List

If you are updating To Do List from an older version, check [Migration to newer version](migration.md) for details.

## Version 1.3

Released on February DAY, 2025

### Fixes

- ...

## Version 1.2.12

Released on November 15, 2024
Expand Down
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ module.exports = {
"api/configs/drag_config",
"api/configs/id_config",
"api/configs/locale_config",
"api/configs/menu_config",
"api/configs/priorities_config",
"api/configs/projects_config",
"api/configs/readonly_config",
Expand Down
4 changes: 2 additions & 2 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ table {
/* small code block */

code {
border-radius: 2px;
padding: 6px 8px;
border-radius: 5px;
padding: 2px 8px;
font-weight: 600;
}

Expand Down

0 comments on commit 6b2aa46

Please sign in to comment.