3.2.0

Chrome, Safari: Combo in Grid, PopUp Position

I am using AW v2.5.3 Grid, when rows scrolled and try to use Combo Box in Chrome and Safari 3.2 on XP, the popup does not comes under the Cell from where it is initiated. You have to scroll to popup which is a way beyond the grid. Code is pasted below:
var dataArr = new Array();
            for (var i = 0; i < 100; i++) {         
                var rowArr = new Array();
                for (var j = 0; j < 15; j++) {
                    
                    if(j % 2 === 0)
                        rowArr.push("row" + i + "-col" + j);
                    else
                        rowArr.push(i * 109223.445);
                }
                dataArr.push(rowArr);
            }
            
            var obj = new AW.Grid.Extended;
            obj.setId("myGrid");

            obj.setRowCount(dataArr.length);
            obj.setColumnCount(dataArr[0].length);

            obj.setHeaderText(["Col01", "Col02", "Col03", "Col04", "Col05", "Col06", "Col07", "Col08", "Col09", "Col10", "Col11", "Col12", "Col13", "Col14", "Col15"]);
            obj.setHeaderTooltip(function(index){ return this.getHeaderText(index); });     // Header Tooltip
            obj.setHeaderCount(2);
            
            obj.setCellData(dataArr);
            obj.setCellTooltip(function(c,r){ return this.getCellText(c, r); });    // Cell Tool Tips
            

            obj.setCellEditable(true);

            var comboData = ["234.54", "23,423.4", "435,435.54", "345.45"];

            var comboObj = new AW.Templates.Combo;

            var comboList = new AW.UI.List;
            comboList.setItemText(comboData);
            comboList.setItemCount(comboData.length);
                        
            obj.setCellTemplate(comboObj, 3);
            obj.setPopupTemplate(comboList, 3);


Thanks in advance
Mukesh Singla
November 21,
Fix for popup position:

obj.setCellEditable(true, 3);

            var comboData = ["234.54", "23,423.4", "435,435.54", "345.45",
                             "234.54", "23,423.4", "435,435.54", "345.45"];

            var comboList = new AW.UI.List;
            comboList.setItemText(comboData);
            comboList.setItemCount(comboData.length);
                        
            obj.setCellTemplate(new AW.Templates.Combo, 3);
            obj.setPopupTemplate(comboList, 3);
            obj.getPopupTemplate(3).setStyle("height", 17*comboData.length);
            
            /**
             *  WebKit[Chrome, Safari] Fix - 
             *      Popup Position around initiating cell irrespective of scrolling
             */
            if(!AW.ie) {
                obj.getCellTemplate(3).showPopup = function() {
                    if (this.$popup){
                        document.body.removeChild(this.$popup);
                        this.$popup = null;
                    }
            
                    var ref = this.element() ? this.element() : document.body;
            
                    var left = AW.getLeft(ref);
                    var top = AW.getTop(ref) + ref.offsetHeight;
                    
                    if(AW.webkit)
                        top -= obj.getScrollTop();
                        
                    if((top + (17 * comboData.length))  > alta.browser.height()) {
                        top -= (+ ref.offsetHeight + (17 * comboData.length));
                    }
            
                    var popup = document.createElement("div");
                    this.$popup = popup;
                    AW.$popup = this;
            
                    document.body.appendChild(popup);
                    popup.className = "aw-popup-window aw-system-control";
                    popup.style.left = left + "px";
                    popup.style.top = top + "px";
                    popup.innerHTML = this.getPopup().toString();
            
                    popup.addEventListener("mousedown", onmousedown, true);
                };
            }
            /**
             *  End: WebKit[Chrome, Safari] Fix - 
             *          Popup Position around initiating cell irrespective of scrolling
             */


Hey Alex, Is there any better solution for this?
Thanks
Mukesh Singla
November 26,

This topic is archived.

See also:


Back to support forum