-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from DHTMLX/next
Updates for v8.4
- Loading branch information
Showing
236 changed files
with
1,942 additions
and
920 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
sidebar_label: eventHandlers | ||
title: JavaScript Combo Box - eventHandlers Config | ||
description: You can explore the eventHandlers config of Combo Box in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite. | ||
--- | ||
|
||
# eventHandlers | ||
|
||
@short: Optional. Adds event handlers to HTML elements of a custom template of Combobox items | ||
|
||
~~~js | ||
eventHandlers?: { | ||
[eventName: string]: { | ||
[className: string]: (event: Event, id: string | number) => void | boolean; | ||
}; | ||
}; | ||
~~~ | ||
|
||
@params: | ||
|
||
The **eventHandlers** object includes a set of `key:value` pairs, where: | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td><i>key</i></td> | ||
<td> the name of the event. Note, that at the beginning of the event name the <b>'on'</b> prefix is used (onclick, onmouseover).</td> | ||
</tr> | ||
<tr> | ||
<td><i>value</i></td> | ||
<td>an object that contains a <i>key:value</i> pair, where <i>key</i> is the css class name that the handler will be applied to and <i>value</i> is a function that takes two parameters:<ul><li><b>event</b> - an event object</li><li><b>id</b> - the id of a Combobox item</li></ul></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
@example: | ||
function template() { | ||
return "<div className='class_name'></div>"; | ||
} | ||
|
||
const combobox = new dhx.Combobox("combobox_container", { | ||
template: template, | ||
eventHandlers: { | ||
onclick: { | ||
class_name: function(event) { | ||
console.log("You clicked on " + event.target.tagName); | ||
// return false; | ||
}, | ||
}, | ||
onmouseover: { | ||
class_name: function(event, id) { | ||
console.log("Item ID: " + id); | ||
}, | ||
} | ||
} | ||
}); | ||
|
||
@descr: | ||
|
||
**Related sample**: [Combobox. HTML template and handling events](https://snippet.dhtmlx.com/00955xwq) | ||
|
||
**Note**. Returning `false` from a handler function will stop the template event bubbling and block triggering of an event on the item with `className`. | ||
|
||
As an alternative way, you may use `stopPropagation()` for this purpose: | ||
|
||
~~~js | ||
eventHandlers: { | ||
onclick: { | ||
class_name: (event) => { | ||
evt = event || window.event; | ||
evt.stopPropagation(); | ||
console.log("button click"); | ||
} | ||
} | ||
} | ||
~~~ | ||
|
||
@changelog: Added in v8.4 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.