mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
a715785a42
commit
2552baeecd
@ -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');
|
||||||
|
Loading…
Reference in New Issue
Block a user