oompah

update panel issue helper .js file

Recommended Posts

if you use the literal method (to render the graphs/charts in a literal) and you are facing the issue of having the chart not render after a postback inside of an ajax update panel you can include this javascript file and it will re-create the content properly for you

 

ASSUMING YOU WRAP THE LITERAL IN A DIV OF THIS FORMAT : <div id="fusiondiv" class="fusiondiv">

 

 

there is a version out there that doesn't work named : updatepanelhook.fusioncharts.js  - replace it with this

 

// Hook up Application event handlers.
var app = Sys.Application.add_init(__fc__AJAX_ApplicationInit);

// Application event handlers for component developers.
function __fc__AJAX_ApplicationInit(sender) {

    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (!prm.get_isInAsyncPostBack()) {
        prm.add_pageLoaded(__fc__AJAX_PageLoaded);
    }
}

function __fc__AJAX_PageLoaded(sender, args) {
    if (args._panelsUpdated.length != 0) {
        for (i = 0; i < args._panelsUpdated.length; i++) {
                var updatedNode = args._panelsUpdated.getElementsByClassName('fusiondiv')[0];
                if (updatedNode) {
                    $('#fusiondiv').html(updatedNode.innerHTML);
                }         

         }
    }
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now