calcCoordUnderMouse(event: MouseEvent, touchEvent: MouseEvent);
event. Mouse cursor movement event. Optional parameter. By default it equals to Null.
touchEvent. Mouse button click event. Optional parameter. By default it is set to Null.
The calcCoordUnderMouse method returns coordinates of the cell under the current cursor position taking into account merged cells.
This method returns an object of the PP.Ui.TabSheetCoord type.
To execute the example, the HTML page must contain the TabSheet component named tabSheet (see Example of Creating the TabSheet Component). Process the cursor movement event MouseMove, while showing coordinates of cells under the cursor taking into account merges:
// Get a cell range by the specified coordinates var range = tabSheet.getRange(0, 1, 1, 0); // Merge cells by the obtained range tabSheet.merge(range); // Get coordinates of the top left cell of the range of merged cells var tlCoord = range.getCorners().tlCoord; // Place the merge in the visible table area if (!tabSheet.isCoordVisibleOrInsideVisibleSpan(tlCoord)) { tabSheet.scrollToRange(range) }; // Process the MouseMove event tabSheet.MouseMove.add(function (sender, eventArgs) { var e = eventArgs.Event /* Get the cell coordinates in the current position of the cursor, considering cell span */ var coord = tabSheet.calcCoordUnderMouse(e); // Output the obtained coordinates console.log("Cell coordinates: (" + coord.colIndex + ", " + coord.rowIndex + ")") });
After executing the example on moving the mouse cursor over the selected cell range the browser console shows only coordinates of the upper left cell in the span:
Cell coordinates: (0, 0)
On moving the cursor over other table cells the browser console shows their coordinates:
Cell coordinates: (2, 1)
Cell coordinates: (2, 0)
See also: