Jquery Flexigrid reload only if flexigrid initially ran

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2011-01-09T03:39:12Z Indexed on 2011/01/09 3:53 UTC
Read the original article Hit count: 384

Filed under:
|
|
|

Im trying to use flexigrid to show results using the values from a form. So when a person clicks a form I want it to load the flexigrid function if its the first time the person clicked the button to initialize the table. Then if someone adjusts the values in the form then clicks the button again it then reloads the flexigrid table with the new form values. How can I do this in one function? Right now I have the flexigrid code running on page load, then if they click the button it runs this:

<script type="text/javascript">
$(function() {

$('#RunReport').click( function() {
    var report_name = $('input[name=report-name]').val();
    var report_cell = $('input[name=report-cell]').val();
    var query_url = encodeURI('name=' + report_name + '&cell=' + report_cell);
    $('#reporting').flexOptions({ url: '/report.php?' + query_url }).flexReload();
});

});
</script>

But instead of having it in both functions I wanted it all in one function only running the reload if flexigrid was already initialized. Hope this makes sense, still new at all of this.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about table