Reputation: 449
I would like to call a function thanks to a jquery event handler. My trigger is the search the user make on my datagrid (navgrid).
I think the best option is to use someting.on("click", function(){})
were "something" represent the search button. My probleme is that I can't figure out how to call this search button.
Then, can we add a balise to this button or is there an other option?
PS: LoadComplete does't work here because I can't acces the functions I want to trigger from my grid.
Upvotes: 0
Views: 159
Reputation: 449
Problem :http://jsfiddle.net/OlegKi/np1gh5pm/6/ Click on the treemap actualize the grid but filtering the grid doesn't affect the treemap
Solution :
Finally I used a div with display none
and print on it the Filter on LoadComplete
thanks to :
document.getElementById("change").innerHTML=$("#jqGrid").getGridParam("postData").filters;
then, I observe the change of the balise thanks to :
$('#change').bind("DOMSubtreeModified",function(){
//block code
});
Then I don't observe directly the end of reload of my grid but an event created by the grid...quite the same!
Upvotes: 0
Reputation: 221997
I'm not sure that I correctly understand your question. To display Searching Dialog you can call
$("#grid").jqGrid("searchGrid");
or
$("#grid").jqGrid("searchGrid", {
searchOnEnter: true,
closeOnEscape: true,
closeAfterSearch: true,
closeAfterReset: true,
multipleGroup: true,
multipleSearch: true
});
it's just an example of some options. You can specify any callbacks of the searching dialog in the same way like the options.
If you really need just click on the Search button of the navigator bar, than you need to know that the id of the button have "search_"
follow the grid id. If you have, for example, grid with id="grid"
then you can use:
$("#search_grid").click();
Upvotes: 0
Reputation: 3689
in html you must have thometing like this
<button class="btn" type="submit">Click me</button>
and in JS (if you are using jQuery)
$('.btn').on("click", function() {
alert('do something here');
});
Upvotes: 0