# HG changeset patch # User Franck Deroche # Date 1263483759 0 # Node ID 2ba96288fbea4f963a642dd31a82d3297c40ed7c # Parent 4344489b20e6c2c0a13593562d53024b9cd23616 Library: Add support for resetting exposed filters diff -r 4344489b20e6 -r 2ba96288fbea js/dnd-library.js --- 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); }