@@ -24,8 +24,8 @@ description: "attaches the handler to an inner event of dhtmlxGantt"
2424### Example
2525
2626~~~ jsx
27- gantt .attachEvent (" onTaskClick" , function (id , e ) {
28- alert (" You've just clicked an item with id=" + id );
27+ gantt .attachEvent (" onTaskClick" , (id , e ) => {
28+ alert (` You've just clicked an item with id=${ id } ` );
2929});
3030~~~
3131
@@ -35,47 +35,46 @@ gantt.attachEvent("onTaskClick", function(id, e) {
3535### Details
3636
3737You can attach several handlers to the same event and all of them will be executed.
38- If some of handlers will return * false* - the related operation will be blocked.
38+ If some of the handlers return * false* , the related operation will be blocked.
3939Event handlers are processed in the same order that they were attached.
4040
41-
42- ## Properties of settings object
41+ ## Properties of settings object
4342
4443The settings object can contain the following properties:
4544
46- - ** id?** - (* string | number* ) - the id of the event handler.
45+ - ` id? ` - (* string | number* ) - the id of the event handler.
4746For example, you can easily detach a handler from the specified event:
4847
49- ~~~ js
50- gantt .attachEvent (" onTaskClick" , function () {
48+ ~~~ js {3}
49+ gantt .attachEvent (" onTaskClick" , () => {
5150 console .log (" task click" );
52- }, {id: " my-click" }); /* !*/
53- ... // after a while:
51+ }, { id: " my-click" });
52+
53+ // after a while
5454gantt .detachEvent (" my-click" );
5555~~~
5656
57- - ** once?** - (* boolean* ) - defines whether the event will be executed only once.
57+ - ` once? ` - (* boolean* ) - defines whether the event will be executed only once.
5858Set the property to * true* if you want to capture the first triggering of the event, as in:
5959
60- ~~~ js
61- gantt .attachEvent (" onTaskClick" , function () {
60+ ~~~ js {4}
61+ gantt .attachEvent (" onTaskClick" , () => {
6262 console .log (" capture next task click" );
6363 return true ;
64- }, {once: true }); /* ! */
64+ }, { once: true });
6565~~~
6666
67- - ** thisObject?** - (* any* ) - specifies the ` this ` object for the listener.
67+ - ` thisObject? ` - (* any* ) - specifies the ` this ` object for the listener.
6868
69- ~~~ js
70- gantt .attachEvent (" onTaskClick" , function (){
69+ ~~~ js {4}
70+ gantt .attachEvent (" onTaskClick" , function () {
7171 // ...
7272 return true ;
73- }, {thisObject: this }); /* ! */
73+ }, { thisObject: this });
7474~~~
7575
7676### Related API
7777- [ detachEvent] ( api/method/detachevent.md )
7878
7979### Related Guides
8080- [ Event Handling] ( guides/handling-events.md )
81-
0 commit comments