:: Forum >> Version 2 >>

A weirdo bug with IE and doctype

Ok, this is weirdest bug I've encountered since I started using AW.

When using strict doctype and IE8, editing the cell in the grid acts really weird. Typing any number of characters in the cell work fine EXCEPT if the user enters TWO characters and hits enter, then the second character is trimmed off and only ONE character is shown in the cell !!!

You can try it with the code below

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html>
  <
head>
    <
script src="../util/controls/lib/aw.js" type="text/javascript"></script>
    <
link href="../util/controls/styles/vista/aw.css" rel="stylesheet">
    <
style type="text/css">
        .
aw-grid-row {height20pxborder-bottom1px solid #DBDFE6}
        .
aw-grid-cell {border-right:1px solid #DBDFE6padding-right:3px;font-size:12font-family:Calibri}s
        
.aw-header-{font-size:12font-family:calibri}
        .
aw-ff3 .aw-ui-button{
            
displayinline-block;
        }
        .
aw-quirks * {
            
box-sizingborder-box;
            -
moz-box-sizingborder-box;
            -
webkit-box-sizingborder-box;
        }
    </
style>
  </
head>
  <
body>
  </
body>
</
html>
<
script>
    var 
obj = new AW.UI.Grid;

    
obj.setHeaderText("header");
    
obj.setColumnCount(10);
    
obj.setRowCount(10);
    
obj.setCellEditable(true);

    
document.write(obj); 
</
script>

 
They way I resolved it was by adding the following. This is obviously a temporary work around, but Alex I think you should check out this bug and find a better solution

var editStarted;
    var 
cellText;

    var 
myEventHandler = function (event){
        if(
window.event)    event window.event//for IE
        
if(editStarted){
            
cellText cellText String.fromCharCode(event.keyCode);
        }
    }

    
obj.onCellEditStarted = function(){
        
editStarted true;
        
cellText "";
    }

    
obj.onCellEditEnded = function(textcolrow){
        
obj.setCellText(cellTextcolrow);
        
obj.focus();
        
obj.selectCell(colrow);
    }

    
obj.setEvent("onkeyup"myEventHandler);
 
Thanks.
-gil
Thursday, August 25, 2011



This topic is archived.

Back to support forum

Forum search