Please check this: http://webix.com/snippet/bedb1ce8
I also have a question - why I can’t use .detachEvent with event name, like this:
$$(‘some_view_id’).detachEvent (‘onAfterSelect’);
Please check this: http://webix.com/snippet/bedb1ce8
I also have a question - why I can’t use .detachEvent with event name, like this:
$$(‘some_view_id’).detachEvent (‘onAfterSelect’);
It is unsafe to remove ALL handlers for some events. Component itself uses event system to link different functionality, so removing all event handlers will break the component’s functionality.
When you are adding event handler, attachEvent command returns event id , that later can be used as parameter of detachEvent
var id = some.attachEvent("onAfterSelect", some);
...
some.detachEvent(id);
Ok, I got it. But the main question is why event remains attached after detaching it by id?
More detailed snipped: http://webix.com/snippet/944fa164
i.e. event doesn’t work, but it’s stated as attached.
Is it a normal behaviour?
It is a bug actually, will be fixed in the oncoming update.
Still in some cases hasEvent API may return “true” as for some events component has default event handlers
That’s quite an unpredictable behaviour.
I guess that default event handlers should return false.
How do you plan to use the hasEvent API ?
Currently it is used by components to increase performance by disabling some expensive branches of code when event handler is not detected. I don’t really see any other use-case for this API ( it may be made private in Webix 3.0 as it is more confusing than usefull )