SilvaM Posted October 13, 2014 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++; } } } }); Quote
Sherzod Posted October 14, 2014 Posted October 14, 2014 Hi SilvaM.XY - mouse coordinates? Best regards. Quote
SilvaM Posted October 14, 2014 Author Posted October 14, 2014 Yes, I need to select the row in the XY mouse coordinates. Thank you. Quote
Administrators Farshad Mohajeri Posted October 14, 2014 Administrators 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. Quote
SilvaM Posted October 14, 2014 Author 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. Quote
Sherzod Posted October 16, 2014 Posted October 16, 2014 Hi SilvaM.You have found a solution?Best regards. Quote
Sherzod Posted October 17, 2014 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.