jQuery UI Widgets › Forums › General Discussions › Angular › Row index of hovered row of JqxGrid
This topic contains 4 replies, has 2 voices, and was last updated by shakti_singh 7 years, 8 months ago.
-
Author
-
Hi,
Is there any method,event,or property which jqxgrid has by which I can get rowindex of the hovered cell/row .
Would greatly appreciate any help regarding this . Urgently required . Need to show a custom tooltip for specific rows in gridThanks,
ShaktiHello shakti_singh,
You can get the rowindex of the hovered cell like this:
$('#jqxGrid').jqxGrid({ cellhover: function (cellhtmlElement, x, y) { var cell = $('#jqxGrid').jqxGrid('getcellatposition', x, y); console.log(cell.row); }});You get the hovered cell coordinates by ‘cellhover’ and pass them to ‘getcellatposition’ method which returns an object that has a ‘row’ property.
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Thanks a lot . I am being able to get the row . However I am unable to access any global variable inside this function . I am working in angular . There is an array selectedRows[] which I have declared outside inside class. However I am unable to access it using this.selectedRows inside this cellhover function . this.selectedRows is coming as undefined . I console logged (this). Only the grid properties & functions are there . Nothing else . I cant even call any other function inside this cellhover apart from the ones which are already defined in ‘this’ . Would greatly appreciate any help regarding this.
Thanks,
ShaktiHello, shakti_singh!
You can use an arrow function for cellhover. In this way no new scope is declared for the function.
selectedRows: number[] = [1, 2, 3]; cellhover = (cellhtmlElement, x, y) => { console.log(this.selectedRows); }Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Thanks a lot !! This solved my issue
Thanks,
Shakti -
AuthorPosts
You must be logged in to reply to this topic.