tablesorter – IE7 shrinking select boxes fix

· Bugs, IE7, tablesorter
Authors

I already blogged about the issue of IE7 shrinking select boxes bug whenever select options are added dynamically.

I just noted that the same issue reproduces when using tablesorter filter-select feature.

This great widget by mottie automatically generates select boxes per <th> that is marked with “filter-select” class.

Since on every sort and filter event the whole table and filter regenerate themselves, the IE7 bug reproduces here as well.

I added this code snippet to the sortEnd and filterEnd events, to fix the shrinking phenomenon:

 

//Detect IE7

var bIsIE7 = navigator.userAgent.match(/MSIE 7/);

//After tablesorter init:

if (bIsIE7) {
  $(‘table’).bind(“sortEnd”, function () {
    fixIE7();
  }).bind(“filterEnd”, function () {
    fixIE7();
  });
}

//Fix IE7

function fixIE7() {
  $(“.tablesorter-filter”).each(function () {
    $(this).css(“width”, “1px”);
    $(this).removeAttr(‘style’);
  });
}

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: