Jump to content

UniDBGrid Get Cell By X Y Position


SilvaM

Recommended Posts

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++; 
            } 
        } 
         
    } 
}); 

 

Link to comment
Share on other sites

Yes, I need to select the row in the XY mouse coordinates.

 

Hi SilvaM.

 

If I understand correctly, try:

 

UniDBGrid1 -> ...

function itemmouseenter(sender, record, item, index, e, eOpts)
{  
  if (sender.getSelectionModel()) {
    sender.getSelectionModel().select(index)
  }; 
}

Works correctly when:

 

1. Grouping.Enabled := False;

2. Options, dgRowSelect := True;

 

Best regards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...