MINOR Catching GridField filter submission to enable usage through enter key in addition to clicking on the filter button (SSF-53)

This commit is contained in:
Ingo Schommer 2012-03-01 12:25:44 +01:00
parent c3f4db1d7d
commit d02a68089f
2 changed files with 15 additions and 1 deletions

View File

@ -141,4 +141,18 @@
});
/**
* Catch submission event in filter input fields, and submit the correct button
* rather than the whole form.
*/
$('.ss-gridfield .filter-header :input').entwine({
onkeydown: function(e) {
if(e.keyCode == '13') {
btn = this.closest('.filter-header').find('.ss-gridfield-button-filter');
this.getGridField().reload({data: [{name: btn.attr('name'), value: btn.val()}]});
return false;
}
}
});
}(jQuery));

View File

@ -1,5 +1,5 @@
<tr>
<% control Fields %>
<th class="extra"><span>$Field</span></th>
<th class="extra filter-header"><span>$Field</span></th>
<% end_control %>
</tr>