3.2.0

Firefox grid combo box popup closing issue

Alex,

Hoping you can help with this one on version 2.5.1. All worked ok with the same code in 2.02.

The combo's popup closes correctly in IE but not in Firefox 2.0. Losing the onItemClicked routine doesn't help. Clicking outside the grid closes the most recent popup but not any others.

My guess is the hidePopup process has changed / the old issue with popup closing in Firefox in 2.01.

Any help much appreciated.

Charles.

var myData = [
    ["1","one", "asdfadf", "fdgsdfga", "qwerqwer"],
    ["2", "two", "sdfdgv", "jsfghatb", "asdfasdf"],
    ["3", "three", "erttun", "uiypo", "dfghdfghd"],
    ["4", "four", "asdfyjh", "lkjlgjkl", "bvncbncbn"],
    ["5", "five", "sfgthnb", "vmnvbmnvbn", "dftynxb"],
  ];
var obj = new AW.Grid.Extended
obj.setSize(400,200); obj.setRowHeight(20);
obj.setId("defaultgrid");
obj.setCellText(myData);
obj.setVirtualMode(false); obj.setHeaderCount(1);
obj.setSelectorVisible(false); obj.setSelectionMode("single-cell");
obj.setHeaderText(['col1','col2','col3','col4','col5']);
obj.setColumnCount(5); obj.setColumnWidth([40,80,80,80,80]);
obj.setRowCount(5); 
// Combo
var mycombo=new AW.Templates.Combo;
obj.setCellTemplate(new AW.Templates.Combo,1);
obj.getCellTemplate(1).setStyle("border","1px solid #999999");
if (AW.ie) {obj.getCellTemplate(1).setStyle("padding","0px");}
obj.setCellEditable(true,1);
obj.setPopupTemplate(function(col, row){
    var list = new AW.UI.List;
    list.setItemText(['one','two','three','four']); list.setItemCount(4);
    list.setStyle("border","1px solid #999999");
    list.setStyle('-moz-box-sizing','border-box');
    list.setStyle('width','80px');	list.setStyle('height','80px');
    list.onItemClicked = function(event, i){ try {
        var t=this.getItemText(i);
        obj.setCellText(t,col,row); // Runs text change event to get OLD value
        obj.setCellValue(t,col,row); // Run change value event
        obj.getCellTemplate(col,row).hidePopup(); // Hide Popup
        } catch (e) { std_showerror(e,'cdaw_makegrid - list.onItemClicked'); }
        }
    //if (!AW.ie) {list.onControlMouseOut=function(event) { obj.getCellTemplate(col,row).hidePopup(); } }
    return list;  
});
document.write(obj);
Charles Dean
January 8,
I would recommend changing the popup-related code to:

var list = new AW.UI.List;
list.setItemText(['one','two','three','four']);
list.setItemCount(4);
list.setStyle("border","1px solid #999999");
list.setStyle('-moz-box-sizing','border-box');
list.setStyle('width','80px');
list.setStyle('height','80px');

obj.setPopupTemplate(list);

// replace default event handler assigned by setPopupTemplate(list)
list.onItemClicked = function(event, i){
    try {
        var t = this.getItemText(i);
        this.$owner.setCellText(t, this.$0, this.$1); 
        this.$owner.setCellValue(t, this.$0, this.$1); 
        AW.$popup.hidePopup();
    }
    catch (e) {
        //
    }
}


setPopupTemplate(list) assigns the default onItemClicked event handler, which puts item text into the cell and closes popup. If you want to replace it you should do it after calling setPopupTemplate method.
Alex (ActiveWidgets)
January 10,

This topic is archived.

See also:


Back to support forum