ENHANCEMENT SSF-53 : add a 'filtered' class to filter button and reset button if its input field has filtering value

This commit is contained in:
Normann Lou 2012-03-06 12:33:21 +13:00
parent a715785a42
commit 2552baeecd

View File

@ -152,13 +152,20 @@
* rather than the whole form. * rather than the whole form.
*/ */
$('.ss-gridfield .filter-header :input').entwine({ $('.ss-gridfield .filter-header :input').entwine({
onmatch: function(){
filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter');
resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset');
if(this.val()) {
filterbtn.addClass('filtered');
resetbtn.addClass('filtered');
}
},
onkeydown: function(e) { onkeydown: function(e) {
filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter'); filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter');
resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset'); resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset');
if(e.keyCode == '13') { if(e.keyCode == '13') {
btns = this.closest('.filter-header').find('.ss-gridfield-button-filter'); btns = this.closest('.filter-header').find('.ss-gridfield-button-filter');
this.getGridField().reload({data: [{name: btns.attr('name'), value: btns.val()}]}); this.getGridField().reload({data: [{name: btns.attr('name'), value: btns.val()}]});
filterbtn.removeClass('hover-alike');
return false; return false;
}else{ }else{
filterbtn.addClass('hover-alike'); filterbtn.addClass('hover-alike');