I solved the issue using a "proxy" button.
I set the h:panelGroup
that surrounded the <p:inputText id="globalFilter">
with display:none
style, like this:
<h:panelGroup style="display:none">
then added an input text in completely other place
<h:panelGroup id="myFilter" >
<h:inputText id="myFilter_text" />
</h:panelGroup>
And bound a JS function which uses the jQuery on()
function (in older jQuery version you can use delegete()
), like this:
function searchKeyPressedHandler() {
$(document).on("keyup", "#myFilter input", function (event) {
var searchValue = document
.getElementById('myFilter_text').value;
$("#myTableId\:globalFilter").val(searchValue);
$("#myTableId\:globalFilter").trigger('keyup')
});
}
Used the $()
and on() because I'm using additional jQuery 1.7.1 library, otherwise I had to use the jQuery()
and instead of
$(document).on("keyup", "#myFilter input",
I would use
jQuery(document).delegate("#myFilter input","keyup",...
(just switched the first and the second arguments)
That's it, and I'm free to place the filter input where ever I want to.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…