SilvaM Posted October 13, 2014 Share Posted October 13, 2014 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++; } } } }); Link to comment Share on other sites More sharing options...
Sherzod Posted October 14, 2014 Share Posted October 14, 2014 Hi SilvaM.XY - mouse coordinates? Best regards. Link to comment Share on other sites More sharing options...
SilvaM Posted October 14, 2014 Author Share Posted October 14, 2014 Yes, I need to select the row in the XY mouse coordinates. Thank you. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 14, 2014 Administrators Share Posted October 14, 2014 In web it is better to avoid absolute positioning. What do you want to achieve? There may be a better way. Link to comment Share on other sites More sharing options...
SilvaM Posted October 14, 2014 Author Share Posted October 14, 2014 I'm having a problem with double click on iPAD. I just think to use onmousedown event by myself (and disable onclick) to try to solve it. Link to comment Share on other sites More sharing options...
Sherzod Posted October 16, 2014 Share Posted October 16, 2014 Hi SilvaM.You have found a solution?Best regards. Link to comment Share on other sites More sharing options...
SilvaM Posted October 17, 2014 Author Share Posted October 17, 2014 Not yet... Link to comment Share on other sites More sharing options...
Sherzod Posted October 17, 2014 Share Posted October 17, 2014 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 More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now