r1019 - branches/dev/grid/ui

r1019 - branches/dev/grid/ui


Author: paul.bakaus
Date: Fri Nov 28 01:08:22 2008
New Revision: 1019
Modified:
branches/dev/grid/ui/ui.infiniteScrolling.js
Log:
infiniteScrolling: fixed IE issue related to setting a new innerHTML on a
table element
Modified: branches/dev/grid/ui/ui.infiniteScrolling.js
==============================================================================
--- branches/dev/grid/ui/ui.infiniteScrolling.js    (original)
+++ branches/dev/grid/ui/ui.infiniteScrolling.js    Fri Nov 28 01:08:22 2008
@@ -17,18 +17,18 @@
$.widget("ui.infiniteScrolling", {
    
    _init: function() {
-    
+
        var self = this;
        this.tbody = $('> table > tbody', this.element);
        this.height = this.element.height();
        this.rowHeight = $('tr', this.tbody).height();
-        
+            
        //Prepare the cache that tells us what already has been loaded and what
not
        this._prepareCache();
-        
+            
        //Alocate all rows in this.options.total to change the scrollbar size
        this._allocateRows();
-    
+        
        //Call update the first time to retrieve the first set of rows
        this._update();
    
@@ -56,14 +56,18 @@
        
        var num = this.options.total - $('tr', this.tbody).length;
        var colspan = $('tr:eq(0) > td', this.tbody).length;
-        var newHTML = '';
+        var newHTML = this.tbody[0].innerHTML;
        
        for (var i=0; i < num; i++) {
            newHTML += '<tr><td
style="height:'+this.rowHeight+'px;border:0;padding:0;margin:0;"
colspan="'+colspan+'"></td></tr>';
        };
-        
-        //Appending this whole block to innerHTML is drastically faster than
individual appends in the loop above
-        this.tbody[0].innerHTML += newHTML;
+            
+        // Appending this whole block to innerHTML is drastically faster than
individual appends in the loop above
+        // TODO: Find out why directly setting the innerHTML is screwing IE
+        if($.browser.msie)
+            this.tbody.html(newHTML);
+        else
+            this.tbody[0].innerHTML = newHTML;
    
    },