jQuery UI Widgets Forums Angular Row index of hovered row of JqxGrid

This topic contains 4 replies, has 2 voices, and was last updated by  shakti_singh 4 years, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • shakti_singh
    Participant

    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 grid

    Thanks,
    Shakti

    • This topic was modified 4 years, 6 months ago by  shakti_singh.

    Martin
    Participant

    Hello 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,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/


    shakti_singh
    Participant

    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,
    Shakti


    Martin
    Participant

    Hello, 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,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/


    shakti_singh
    Participant

    Thanks a lot !! This solved my issue

    Thanks,
    Shakti

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.