:: Forum >>

Combo on grid can’t be closed for AW 2.5.3

Once combo is selected it can’t be closed on FF 3.0.1 and Chome 0.2. On IE 6 works fine.

This example use to be working with AW 2.0.2 for FF 2/3 and IE 6

<html>
<head>
<script src="runtime/lib/aw.js"></script>
<link href="runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>

<script>

var HeaderText = ["Number","Description"];
var CellText = [
["1","Description 1"],
["2","Description 2"],
["3","Description 3"],
["4","Description 4"],
["5","Description 5"]
];

var obj = new AW.UI.Grid;

obj.setHeaderText(HeaderText);
obj.setCellText(CellText);
obj.setColumnCount(2);
obj.setRowCount(5);

// BEGIN COMBO POPUP CODE
rowCombo = new AW.Templates.Combo;
obj.setCellTemplate(rowCombo, 1);

obj.setPopupTemplate(function(col, row){

var grid = this;
var list = new AW.UI.List;

list.setItemText(["text1", "text2", "text3"]);
list.setItemCount(3);

list.onItemClicked = function(event, i){
var text = this.getItemText(i);
grid.setCellText(text, col, row);
grid.setCellValue(text, col, row);
grid.getCellTemplate(col, row).hidePopup();
}
return list;
});

// END COMBO POPUP CODE


document.write(obj);
</script>

</body>
</html>


How can I solve this issue?

Thanks & Regards
Carlos
Wednesday, October 29, 2008
Hi new Carlos, this is the "old" Carlos,

I think you can just add:

obj.setCellEditable(true);

That was suggested by Alex here:

http://www.activewidgets.com/javascript.forum.21858.9/dynamic-combo-in-a-grid.html

Hope this helps
C a r l o s
Wednesday, October 29, 2008
Thanks Carlos for your tip

Now for FF the combo is closed if I click out of the box and the grid cell is updated.
But for Chrome is closed after I select an Item, but the grid cell is not updated since onItemClicked event is never called

Regards
Carlos (new)
Wednesday, October 29, 2008
Uppsss!
I was just going to answer :
( why can't you use the code provided in mentioned post?? )
When I realized 2.5.3 have exactly the same "bug" that 2.5.1/2? has, and described in same thread:
clicking twice on the same combo-arrow produces a "unclosable list-popup" effect.
Carlos (old :-)
Wednesday, October 29, 2008
Just tested in FF30
Wednesday, October 29, 2008
Sorry, my fault,
Alex sample in:
/javascript.forum.21858.9/dynamic-combo-in-a-grid.html
Worked pretty Fine in FF-3.0 if add obj.setEditable(true).

So Carlos, you can just use it or moify you sample like this:
Note:obj.setCellEditable(true); is Also needed.

<script>

var HeaderText = ["Number","Description"];
var CellText = [
["1","Description 1"],
["2","Description 2"],
["3","Description 3"],
["4","Description 4"],
["5","Description 5"]
];

var obj = new AW.UI.Grid;

obj.setHeaderText(HeaderText);
obj.setCellText(CellText);
obj.setColumnCount(2);
obj.setRowCount(5);

obj.setCellEditable(true);
rowCombo = new AW.Templates.Combo;

var list = new AW.UI.List;
list.setItemText(["text1", "text2", "text3"]);
list.setItemCount(3);

obj.onCellTextChanged = function(text,col,row){
if(col==1){
this.setCellValue(text+'-Value',col,row);
}
alert(this.getCellValue(col,row) ) ;
}

obj.setCellTemplate(rowCombo, 1);
obj.setPopupTemplate(list,1);

document.write(obj);
</script>

HTH
Carlos any
Wednesday, November 5, 2008
Thanks Carlos !. Your example works for FF , IE and Chrome !
Carlos (new)
Friday, November 7, 2008

This topic is archived.


Back to support forum

Forum search