tags:

views:

411

answers:

1

I have a jQuery AJAX data grid that loads a list of elements from a database. On the page are radio buttons that allow the user to filter the results. These trigger an onClick function that then refreshes the AJAX.

This all works fine.

Now I need to pre-define the radio settings dynamically in the PHP code and have the AJAX load these dynamic settings when the page loads. I don't want to include these changes in the initial AJAX call as other pages use the same code. What I'm hoping to do is load the default script then trigger a grid reload.

I've tried adding the re-load after the initial AJAX call...

<script type="text/javascript">
jQuery(document).ready(function(){
    jQuery("#resource_grid1").jqGrid({        
        ...
    });
});

jQuery(document).ready(function(){
    gridReload();
});

But this doesn't work.

Hope someone can help. :)

+1  A: 

I'm not familiar with jqGrid, but this might help:

You said, 'What I'm hoping to do is load the default script then trigger a grid reload.' The way your code posted above is written, if .jqGrid contains code that execute asynchronously (like, say, pulling JSON data down from the server), then gridReload() will run before jqGrid is fully initialized. Does jqGrid provide something like an onSuccess() function that it fires after it's fully initialize? if so, put your gridReload() code in there.

T. Stone
Thanks for your response. There is a 'loadComplete' event. :)
Das123