Related to issue 20207: Improved Dojo grids visualization in IE9 using HTML5
authorDavid Baz Fayos <david.baz@openbravo.com>
Thu, 10 May 2012 02:12:21 +0200
changeset 16469 04147d5e6a99
parent 16468 7e3737728bba
child 16470 04ccc3dd35e3
Related to issue 20207: Improved Dojo grids visualization in IE9 using HTML5
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.html
web/js/searchs.js
web/js/utils.js
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.html	Mon May 07 11:59:34 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/BatchPaymentExecution.html	Thu May 10 02:12:21 2012 +0200
@@ -93,8 +93,18 @@
 function calculateNumRows() {
   resizeArea();
   document.getElementById("grid_sample").style.display = "block";
-  var grid_header_height = document.getElementById("grid_sample_header").clientHeight + 1;
-  var grid_row_height = document.getElementById("grid_sample_row").clientHeight + 1;
+  var grid_header = document.getElementById("grid_sample_header");
+  var grid_row = document.getElementById("grid_sample_row");
+  var grid_header_height, grid_row_height;
+
+  if (isIE9Strict) {
+    grid_header_height = parseInt(getComputedStyle(grid_header, null).getPropertyValue("height").replace('px', ''), 10) + 4;
+    grid_row_height = parseInt(getComputedStyle(grid_row, null).getPropertyValue("height").replace('px', ''), 10) + 1;
+  } else {
+    grid_header_height = grid_header.clientHeight + 1;
+    grid_row_height = grid_row.clientHeight + 1;
+  }
+
   if (getBrowserInfo('name').toUpperCase().indexOf("CHROME") != -1 || getBrowserInfo('name').toUpperCase().indexOf("SAFARI") != -1) {
     grid_header_height = grid_header_height + 1;
     grid_row_height = grid_row_height - 1;
@@ -108,19 +118,28 @@
   var bottomrow_cont = document.getElementById("bottomRow");
   var related_info_cont = document.getElementById("related_info_cont");
   var client_height = document.getElementById("client").clientHeight;
+  
+  if (isIE9Strict) {
+    client_height = client_height
+        - 25
+        - grid_header_height
+        - (related_info_cont?related_info_cont.clientHeight:0)
+        - 30 - 30 - 30 - 36 - 40 - 40
+        - (messagebox_cont?messagebox_cont.clientHeight:0);
+  } else {
+    client_height = client_height
+        - 20
+        - grid_header_height
+        - (related_info_cont?related_info_cont.clientHeight:0)
+        - (filterRow1_cont?filterRow1_cont.clientHeight:0)
+        - (filterRow2_cont?filterRow2_cont.clientHeight:0)
+        - (filterRow3_cont?filterRow3_cont.clientHeight:0)
+        - (filterRow4_cont?filterRow4_cont.clientHeight:0)
+        - (filterRow5_cont?filterRow5_cont.clientHeight:0)
+        - (bottomrow_cont?bottomrow_cont.clientHeight:0)
+        - (messagebox_cont?messagebox_cont.clientHeight:0);
+  }
 
-  client_height = client_height
-      - grid_header_height
-      - (related_info_cont?related_info_cont.clientHeight:0)
-      - (filterRow1_cont?filterRow1_cont.clientHeight:0)
-      - (filterRow2_cont?filterRow2_cont.clientHeight:0)
-      - (filterRow3_cont?filterRow3_cont.clientHeight:0)
-      - (filterRow4_cont?filterRow4_cont.clientHeight:0)
-      - (filterRow5_cont?filterRow5_cont.clientHeight:0)
-      - (bottomrow_cont?bottomrow_cont.clientHeight:0)
-      - (messagebox_cont?messagebox_cont.clientHeight:0);
-  
-  client_height = client_height - 20;
   var numRows = (client_height)/(grid_row_height);
   numRows = parseInt(numRows);
   if (numRows > 1) { numRows -= 1; }
--- a/web/js/searchs.js	Mon May 07 11:59:34 2012 +0200
+++ b/web/js/searchs.js	Thu May 10 02:12:21 2012 +0200
@@ -514,8 +514,18 @@
 function calculateNumRows() {
    resizeAreaInfo();
    document.getElementById("grid_sample").style.display = "block";
-   var grid_header_height = document.getElementById("grid_sample_header").clientHeight + 1;
-   var grid_row_height = document.getElementById("grid_sample_row").clientHeight + 1;
+   var grid_header = document.getElementById("grid_sample_header");
+   var grid_row = document.getElementById("grid_sample_row");
+   var grid_header_height, grid_row_height;
+
+   if (isIE9Strict) {
+     grid_header_height = parseInt(getComputedStyle(grid_header, null).getPropertyValue("height").replace('px', ''), 10) + 4;
+     grid_row_height = parseInt(getComputedStyle(grid_row, null).getPropertyValue("height").replace('px', ''), 10) + 1;
+   } else {
+     grid_header_height = grid_header.clientHeight + 1;
+     grid_row_height = grid_row.clientHeight + 1;
+   }
+
    if (getBrowserInfo('name').toUpperCase().indexOf("CHROME") != -1 || getBrowserInfo('name').toUpperCase().indexOf("SAFARI") != -1) {
      grid_header_height = grid_header_height + 1;
      grid_row_height = grid_row_height - 1;
--- a/web/js/utils.js	Mon May 07 11:59:34 2012 +0200
+++ b/web/js/utils.js	Thu May 10 02:12:21 2012 +0200
@@ -26,6 +26,9 @@
  * Code that will be executed once the file is parsed
 */
 function utilsJSDirectExecution() {
+  if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1 && getBrowserInfo('documentMode') >= 9 && parseInt(getBrowserInfo('majorVersion'), 10) >= 9) {
+    isIE9Strict = true;
+  }
   isWindowInMDIPopup = checkWindowInMDIPopup();
   isWindowInMDITab = checkWindowInMDITab();
   isWindowInMDIPage = checkWindowInMDIPage();
@@ -33,9 +36,6 @@
   if (isWindowInMDIPage) {
     adaptSkinToMDIEnvironment();
   }
-  if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1 && getBrowserInfo('documentMode') >= 9 && parseInt(getBrowserInfo('majorVersion'), 10) >= 9) {
-    isIE9Strict = true;
-  }
 }
 
 var isIE9Strict = false;
@@ -246,7 +246,7 @@
 function getElementsByName(name, tag) {
   var resultArray = [];
   if (!tag || tag == "" || tag == null || typeof tag == "undefined") {
-    if (navigator.userAgent.toUpperCase().indexOf("MSIE") != -1 && !isIE9Strict) {
+    if (navigator.userAgent.toUpperCase().indexOf("MSIE") != -1) {
       var inputs = document.all;
       for (var i=0; i<inputs.length; i++){
         if (inputs.item(i).getAttribute('name') == name){
@@ -3400,6 +3400,9 @@
     addStyleRule(".Popup_ContentPane_SeparatorBar", "display: none;");
     addStyleRule(".Popup_ContentPane_CircleLogo", "display: none;");
   }
+  if (isIE9Strict) {
+    addStyleRule("th.DataGrid_Header_Cell", "height: 20px;");
+  }
 }
 
 /**