Search code examples
jquery-uidotnetnukejquery-ui-tabsrenderpartial

Dotnetnuke partial rendering make my jQueryUI widget stop working


I want to use tab widget of jQueryUI in dotnetnuke 5.6.3 I registered jQueryUI in my module and it works fine but when I use partial Rendering in my page it fails to load.

Here is my code:

$(document).ready(function () {
    rastaAdmin();
});
function rastaAdmin() {
var tabdiv = $('#tabul');
var tabvar = tabdiv.tabs();
}

this site have a method to solve my problem but it doesn't work in my script.

After reading the above site I changed my code to:

$(document).ready(function () {
    rastaAdmin();
});
function pageLoad(sender, args) {
    rastaAdmin();
}
function rastaAdmin() {
var tabdiv = $('#tabul');
var tabvar = tabdiv.tabs();
}

This Doesn't work for me.

What Can I do?

Thank You


Solution

  • I've had issues using the pageLoad function as well (though I don't remember now where it ended up breaking down). However, something like the other method should work fine (see the new jQuery UI setup in the core modules in DNN 6):

    $(document).ready(function () {
        setupDnnSiteSettings();
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () {
            setupDnnSiteSettings();
        });
    });
    

    The one caveat here is that this registers the setup code to happen after returning from any UpdatePanel-initiated request, not just your specific UpdatePanel. Calling tabs again on the same element shouldn't cause any issue, but you'll want to figure out a way to differentiate if you're doing something that should only be called once.