Mar 11, 2009

jQuery tidbits

Here are a couple quick things that will hopefully help some other people out there in the jQuery world.

  • YUI Grids and the jQuery UI don't like each other. You get one or the other.
  • With version 1.7 of the UI, be sure to use the destroy method instead of close. Otherwise you won't be able to open that dialog again without a refresh. Credit goes to my coworker for figuring out what the overall solution is. To make sure it always uses destroy, i did the following:

    Step 1) add the option:


    close: function(e,ui) { destroyDialog(this) }


    Step 2) then made the destroyDialog function do this:


    function destroyDialog(ui) {
    $(ui).dialog('destroy');
    }


  • Next I was trying to reload html into DIV's where the data was being refreshed. The easiest thing to do would be use $.load(). What I found out is that the cache option in the call is true and IE will never get the new data without deleting your offline files. To fix this i made the following reusable function:


    function reload(reloadurl,id) {
    $.ajax({
    url: reloadurl,
    cache: false,
    success: function(html) {
    $(id).html(html);
    }
    })
    }

No comments:

Post a Comment