[FIX] Implemented Clear button for search view.

bzr revid: kbh@bde-desktop-20110804110922-chcld5vyoovumzha
This commit is contained in:
kbh 2011-08-04 16:39:22 +05:30
parent 0094e828b9
commit 07c4f41e31
1 changed files with 20 additions and 4 deletions

View File

@ -315,10 +315,26 @@ openerp.base.SearchView = openerp.base.Widget.extend({
on_invalid: function (errors) {
this.notification.notify("Invalid Search", "triggered from search view");
},
do_clear: function (e) {
if (e && e.preventDefault) { e.preventDefault(); }
this.on_clear();
},
do_clear: function () {
this.$element.find(':input').each(function(){
switch(this.type) {
case 'text':
case 'string':
$(this).val('');
break;
}
});
var string = ($("div.expanded").not("#oe_app_search table:first-child .expanded"));
if (string){
$(string).removeClass('expanded');
$(string).addClass('folded');
}
$('#oe_app_search table:last').css('display', 'none');
$('.searchview_extended_groups_list').empty();
$('.filter_label').removeClass('enabled');
this.$element.find('form').submit();
},
/**
* Triggered when the search view gets cleared
*