3.2.0

Combo in cell (possibly incorrect js code) crashes IE7

Hi Alex,

The version of IE7 I'm using is IE 7.0.5730.13 and AW 2.5.2
The code is given below.
It just embeds a combo on cell double click and puts the selected item text into the cell text.
When I double click on any cell using IE7, select a value from the dropdown and then click on another cell, the browser crashes (Internet Explorer has encountered a problem and needs to close ...)

I'm wondering if the problem line is obj.setCellTemplate(new AW.Templates.ImageText, col, row) ?
When I comment it out, the browser doesn't crash, but the combo doesn't disappear either.
Is there some other template I can set it to that won't crash the browser ?
Or is there something basic that I'm missing out ?

Also note that the code works fine in FF3 - that why I was using it till now.
Only when I recently tested it in IE7 did I notice the crash.

var obj = new AW.Grid.Extended;
obj.setCellText(function(i, j){return j + "." + i});
obj.setHeaderText(["header1", "header2", "header3", "header4", "header5", "header6", "header7", "header8", "header9", "header10"], 0);
obj.setFixedLeft(0);

obj.setColumnCount(10);
obj.setRowCount(100);

obj.onCellDoubleClicked = function(event, col, row) {

    var combo = new AW.UI.Combo;
    var originalText = obj.getCellText(col, row);

    obj.setCellTemplate(combo, col, row);
    obj.getCellTemplate(col, row).setControlText(originalText);
    obj.getCellTemplate(col, row).setItemText(["a", "b", "c", "d"]);
    obj.getCellTemplate(col, row).setItemCount(4);
    obj.getCellTemplate(col, row).getContent('box/text').setAttribute('readonly', true);

    obj.getCellTemplate(col, row).onControlEditEnded = function(text) {
        obj.setCellTemplate(new AW.Templates.ImageText, col, row);
        obj.getRowTemplate(row).refresh();
        obj.setCellText(text, col, row);
    }

    obj.getRowTemplate(row).refresh();
    obj.getCellTemplate(col, row).getContent('box/text').element().focus();

}

document.write(obj);


Thanks,
Ankur
Ankur Motreja
August 6,
Hi,

Tested it a bit more today and looks like it happens only when you click on another cell in the same row.
That is, once you bring up the combo, click on another cell in the same row and the browser crashes.
Clicking on a cell in some other row doesn't seem to cause the problem.

Thanks,
Ankur
Ankur Motreja
August 7,
Then, change:
obj.getRowTemplate(row).refresh();
with:
obj.getCellTemplate(col,row).refresh();
August 7,
Thanks for replying.
However, using obj.getCellTemplate(col,row).refresh() doesn't seem to refresh the cell properly and leaves behind a non-functional combo box in the cell.

Ankur
Ankur Motreja
August 7,
Hi Alex,

We too have found a similar problem yesterday. This code was works with the previous version of active widgets.

var importTemplate = new AW.UI.Combo;
importTemplate.setId("importTemplate");
importTemplate.setControlText("");
importTemplate.setItemText(["Template 1","Template 2", "Template 3"]);
var template = importTemplate.getPopupTemplate();
template.setStyle("font-size", "12px");
importTemplate.setItemCount(3);
importTemplate.refresh();

when we load this page we replace the dummy text with good data for the drop down from the database. We found that when we try and click on the drop down list that is created it flashes on the screen with the correct data and then blanks out the drop down and flickers until we either change screens or it eats up all resources and kills the browser (IE only - firefox is ok). Or if you click on another object on the screen in the grid it crashes ie immediately.

Robert Muehlbauer
August 7,
Hi Alex,

Any news on this problem ?

Thanks,
Ankur
Ankur Motreja
August 11,
It seems that the problem is related to the focus location and refresh and could be fixed if you force the focus out of the refreshed cell/row. Add obj.focus() before doing any manipulations with the cell - this will move the focus into 'hidden' input box inside the grid.

obj.getCellTemplate(col, row).onControlEditEnded = function(text) {

        obj.focus();

        obj.setCellTemplate(new AW.Templates.ImageText, col, row);
        obj.setCellText(text, col, row);

        obj.setTimeout(function(){
            obj.getRowTemplate(row).refresh();
        })
    }



Another suggestion would be using combo template instead of the combo control.
Alex (ActiveWidgets)
August 14,
Thanks Alex.
That works.

Ankur
Ankur Motreja
August 15,

This topic is archived.

See also:


Back to support forum