Skip to content

Commit

Permalink
752177 - Adds clearing of search hash when search input is cleared
Browse files Browse the repository at this point in the history
manually or via Clear from dropdown.
  • Loading branch information
ehelms committed Jan 4, 2012
1 parent ec44693 commit fcbe755
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/public/javascripts/panel.js
Expand Up @@ -478,6 +478,11 @@ KT.panel = (function ($) {
}
else if (!refresh) {
closePanel();

if( search_element.val() !== "" && search === undefined ){
search_element.val('');
$('#search_form').trigger('submit');
}
}
}
return false;
Expand Down Expand Up @@ -722,7 +727,6 @@ KT.panel.list = (function () {
expand_list = $('.expand_list');
}
retrievingNewContent = false;
console.log(data);
expand_list.append(data['html']);
$('.list-spinner').remove();
if (data['current_items'] === 0) {
Expand Down Expand Up @@ -852,6 +856,15 @@ KT.panel.list = (function () {
}
});
});

$('#search').live('change', function(){
var value = $(this).val();

if( value === "" ){
$.bbq.removeState("search");
$('#search_form').trigger('submit');
}
});
};
return {
set_extended_cb : function (callBack) { extended_cb = callBack; },
Expand Down
10 changes: 7 additions & 3 deletions src/public/javascripts/search.js
Expand Up @@ -61,8 +61,12 @@ var favorite = (function() {
client_common.destroy(url, favorite.success, favorite.error);
},
clear : function(data){
$('#search').val('');
$('#search_form').submit();
var search_form = $('#search_form'),
search_input = search_form.find('#search');

search_input.val('');
search_input.change();
$('#search_form').submit();
$('.qdropdown').hide();
}
}
Expand Down Expand Up @@ -132,4 +136,4 @@ KT.search = (function($){
enableAutoComplete : enableAutoComplete
};

})(jQuery);
})(jQuery);

0 comments on commit fcbe755

Please sign in to comment.