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(x, y) { var view = this, rows = view.getRows(); //loop rows for (var i = 0; i < rows.length; i++) { var j = 0, cell; //loop cells in row while (cell = view.getCell(i, j)) { var cellEl = Ext.get(cell); if (cellEl.getTop() <= y && cellEl.getBottom() >= y) { if (cellEl.getLeft() <= x && cellEl.getRight() >= x) { return [i, j, cell]; } } else { //prevent useless cell loops in wrong row break; } j++; } } } });