Jump to content

SilvaM

Members
  • Posts

    10
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by SilvaM

  1. Hi!

     

    I need to select a cell (or a row) in a UniDBGrid using XY Position. 

     

    How could I implement something like this:

     

    Ext.override(Ext.grid.GridView, { 

        /** 
         * Returns a cell row, col, and element, by the xy coodinates 
         *  
         * @param {Integer} x 
         * @param {Integer} y 
         * @returns {Array} [row, col, el] 
         */ 
        
    getCellByXY: function(xy) { 
            var 
    view this
                
    rows view.getRows(); 
             
            
    //loop rows 
            
    for (var 0rows.lengthi++) { 
                var 
    0cell
                
    //loop cells in row 
                
    while (cell view.getCell(ij)) { 
                    var 
    cellEl Ext.get(cell); 
                     
                    if (
    cellEl.getTop() <= && cellEl.getBottom() >= y) { 
                        if (
    cellEl.getLeft() <= && cellEl.getRight() >= x) { 
                            return [
    ijcell];  
                        } 
                    } else { 
                        
    //prevent useless cell loops in wrong row 
                        
    break; 
                    } 
                     
                    
    j++; 
                } 
            } 
             
        } 
    }); 

     

×
×
  • Create New...