From a83bd29ada53e574a9ce7a402b0623c3ace74fef Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 13 Apr 2011 16:07:35 +0200 Subject: [PATCH] [IMP] document automatic binding of do_ and on_ methods of BasicController subclasses bzr revid: xmo@openerp.com-20110413140735-hc8nbxxos4yl11xj --- doc/source/addons.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/source/addons.rst b/doc/source/addons.rst index bba57b40bd0..bca568f58df 100644 --- a/doc/source/addons.rst +++ b/doc/source/addons.rst @@ -110,6 +110,23 @@ initializing the addon. }); } +Utility behaviors +----------------- + +JavaScript +++++++++++ + +* All javascript objects inheriting from + :js:class:`openerp.base.BasicConroller` will have all methods + starting with ``on_`` or ``do_`` bound to their ``this``. This means + they don't have to be manually bound (via ``_.bind`` or ``$.proxy``) + in order to be useable as bound event handlers (event handlers + keeping their object as ``this`` rather than taking whatever + ``this`` object they were called with). + + Beware that this is only valid for methods starting with ``do_`` and + ``on_``, any other method will have to be bound manually. + .. _addons-testing: Testing