Mark Lavin avatar Mark Lavin committed da3099b

Adding documentation and release notes for new JS events. Fixes #71

Comments (0)

Files changed (2)

docs/advanced.rst

 For the most part these event names should be self-explanatory. If you need additional
 detail you should refer to the `jQuery UI docs on these events <http://jqueryui.com/demos/autocomplete/#events>`_.
 
+The multiple select widgets include additional events which indicate when a new item is added
+or removed from the current list. These events are ``djselectableadd`` and ``djselectableremove``.
+These events pass a dictionary of data with the following keys
+
+    - element: The original text input
+    - input: The hidden input to be added for the new item
+    - wrapper: The ``<li>`` element to be added to the deck
+    - deck: The outer ``<ul>`` deck element
+
+You can use these events to prevent items from being added or removed from the deck by
+returning ``false`` in the handling function. A simple example is given below:
+
+    .. code-block:: html
+
+        <script type="text/javascript">
+            $(document).ready(function() {
+                $(':input[name=my_field_0]').bind('djselectableadd', function(event, item) {
+                    // Don't allow foo to be added
+                    if ($(item.input).val() === 'foo') {
+                        return false;
+                    }
+                });
+            });
+        </script>
+
 
 Submit On Selection
 --------------------------------------

docs/releases.rst

 
 - Initial translations (pt_BR). Thanks to Felipe Prenholato for the patch.
 - Upgraded default jQuery UI version included by the template tags from 1.8.18 to 1.8.23
+- Added ``djselectableadd`` and ``djselectableremove`` events fired when items are added or removed from a mutliple select
 
 Bug Fixes
 _________________
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.