3.2.0

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 {height: 20px; border-bottom: 1px solid #DBDFE6}
        .aw-grid-cell {border-right:1px solid #DBDFE6; padding-right:3px;font-size:12; font-family:Calibri}s
        .aw-header-0 {font-size:12; font-family:calibri}
        .aw-ff3 .aw-ui-button{
    		display: inline-block;
        }
        .aw-quirks * {
            box-sizing: border-box;
            -moz-box-sizing: border-box;
            -webkit-box-sizing: border-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(text, col, row){
        obj.setCellText(cellText, col, row);
        obj.focus();
        obj.selectCell(col, row);
    }

    obj.setEvent("onkeyup", myEventHandler);


Thanks.
-gil
August 25,

This topic is archived.

See also:


Back to support forum