From c4a8ea956c9116936c4de3eea56b7c49bc13d1e2 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Mon, 8 Sep 2014 08:56:38 +0200 Subject: [PATCH] Mention loadfield event --- README.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 190f4f25..91424561 100644 --- a/README.rst +++ b/README.rst @@ -389,7 +389,20 @@ The related template would look like this: -If you need to customize the map used by the widget, first override the JavaScript field behaviour by extending ``L.GeometryField``, then in Django subclass the ``LeafletWidget`` to specify the custom ``geometry_field_class``. + +Every map field will trigger an event you can use to add your custom machinery : + +:: + + map.on('map:loadfield', function (e) { + ... + // Customize map for field + console.log(e.field, e.fieldid); + ... + }); + + +If you need a reusable customization of widgets maps, first override the JavaScript field behaviour by extending ``L.GeometryField``, then in Django subclass the ``LeafletWidget`` to specify the custom ``geometry_field_class``. ::