Skip to content

Commit

Permalink
Mention loadfield event
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Sep 8, 2014
1 parent c3cacb9 commit c4a8ea9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,20 @@ The related template would look like this:
</body>
</html>

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``.

::

Expand Down

0 comments on commit c4a8ea9

Please sign in to comment.