2018-01-11 10:00:51 +00:00
|
|
|
# Dropdown
|
|
|
|
|
|
|
|
Creates a Dropdown button with JS events
|
|
|
|
|
|
|
|
## API
|
|
|
|
|
|
|
|
Methods
|
|
|
|
|
|
|
|
- `add_item`
|
|
|
|
- `float_right`
|
|
|
|
- `expand`
|
|
|
|
- `collapse`
|
|
|
|
- `toggle`
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Create
|
|
|
|
|
|
|
|
```js
|
2018-01-16 06:09:17 +00:00
|
|
|
const Dropdown = require('frappejs/frappe/client/ui/dropdown');
|
2018-01-11 10:00:51 +00:00
|
|
|
|
|
|
|
let dropdown = new Dropdown({label:'Actions', parent:this.toolbar});
|
|
|
|
```
|
|
|
|
|
|
|
|
### Add Item
|
|
|
|
|
|
|
|
Add a new link to the dropdown
|
|
|
|
|
|
|
|
```js
|
|
|
|
dropdown.add_item('Delete', async () => {
|
|
|
|
this.show_alert('Deleted', 'success');
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
### Float Right
|
|
|
|
|
|
|
|
Move the element to the right
|
|
|
|
|
|
|
|
```js
|
|
|
|
dropdown.float_right();
|
|
|
|
```
|