Wednesday, May 27, 2009

jQuery UI scoped themes and the Dialog widget

There's a problem using scoped themes with jQuery UI's Dialog widget in the 1.6 and 1.7 releases (and possibly 1.7.1 as well).

Christoph Herold mentioned his workaround - wrapping the dialog's DOM with a scoping div (with the scoped theme's class name). I wrote a small jQuery plugin that does this and works fine so far:

// Wraps the dialog in a div with the scoping class on
// dialog open, removes the scoping class on dialog close
$.fn.dialogScopingWorkaround = function(scopingClass) {
  this.bind('dialogopen', function(event, ui) {
    $(this).parents(".ui-dialog").wrap(
      '<div class="dialogScopingWrapper '
      + scopingClass
      + '"></div>'
    );
  });
  this.bind('dialogclose', function(event, ui) {
    var wrapper = $(this).parents(".dialogScopingWrapper");
    wrapper.replaceWith(wrapper.children());
  });
  return this;
};

Example with the "smoothness" theme scoped with class "theme-smoothness":

$('#dialog').dialogScopingWorkaround("theme-smoothness").dialog();

// Must call the workaround before opening the dialog
// so the 'dialogopen' event is bound.

Sunday, May 17, 2009

IE7 compatibility image wants to install IE8

I use Microsoft's IE Application Compatibility virtual machine images to test web sites with IE6 and IE7. Well, today my IE7 virtual machine wanted to automatically update to IE8. Great for the web, funny for an IE7 compatibility test image :)

Thursday, May 14, 2009

Ajax.NET Professional "onTimeout" exception

We just upgraded to Ajax.NET Professional 9.2.17.1 and started seeing these JavaScript exceptions in file "core.ashx":

this.onTimeout is not a function

It turns out this is a known issue with synchronous calls done with AjaxPro's client-side JS. We should probably have ditched it and used regular jQuery AJAX calls on the client side (like here and here) but we haven't gotten around to that yet.

Our workaround was easy - we were making a "fire and forget" call, so it didn't need to be synchronous (we added an empty callback handler to the arg list). We could have also patched the JS ourselves and: