changeset 46:2ba96288fbea

Library: Add support for resetting exposed filters
author Franck Deroche <defr@ows.fr>
date Thu, 14 Jan 2010 15:42:39 +0000
parents 4344489b20e6
children cbfe386cb51b
files js/dnd-library.js
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/js/dnd-library.js	Wed Nov 25 15:51:40 2009 +0000
+++ b/js/dnd-library.js	Thu Jan 14 15:42:39 2010 +0000
@@ -149,6 +149,23 @@
     });
     return false;
   });
+  $('.view-filters input[type=reset]', $this).click(function() {
+    var reset = $(this);
+    $('.view-filters form', $this).ajaxSubmit({
+      'url' : Drupal.settings.basePath + settings.url,
+      'dataType' : 'json',
+      'success' : function(data) {
+        var target = reset.parents('div.dnd-library-wrapper');
+        Drupal.behaviors.dndLibrary.renderLibrary.call(target, data, $(editor));
+      },
+      'beforeSubmit': function (data, form, options) {
+        // Can't use data = [], otherwise we're creating a new array
+        // instead of modifying the existing one.
+        data.splice(0, data.length);
+      }
+    });
+    return false;
+  });
   Drupal.attachBehaviors($this);
 }