Author Topic: Show jQuery dialog onmouseover of a cell  (Read 3699 times)

glt

  • Newbie
  • *
  • Posts: 8
    • View Profile
Show jQuery dialog onmouseover of a cell
« on: October 05, 2018, 06:36:55 am »
Hi PQ,

In the render function for a column, I need code that will show a jQuery dialog on cell mouseover.

I have this (doesn't work due to promoToolTip() function being out of scope):

Code: [Select]
render: function ( ui ) {
                        var oRowData = ui.rowData;
                        var oDataIdx = ui.dataIndx;
                        var strEmpCode = oRowData["EmpCode"];
                        var strCellValue = "";
                        if (oRowData[oDataIdx] == "Merit Promotion") {
                            strCellValue = "<a href=\"#\" onmouseover=\"promoToolTip('" + strEmpCode + "');\" onclick=\"return false;\">Merit  Promotion</a>";
                        }
                        else
                            strCellValue = "Merit Promotion";
                        return strCellValue;
}

Instead I need to bind the call to promoToolTip to the cell's mouseover event using jQuery.
How do I do that?

Cheers,
Geoff

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Show jQuery dialog onmouseover of a cell
« Reply #1 on: October 05, 2018, 07:55:13 am »
No idea of promoToolTip

jQuery tooltip is bound to whole cells by adding title attribute to cells as in this example:

https://paramquery.com/demos/comments

glt

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Show jQuery dialog onmouseover of a cell
« Reply #2 on: October 05, 2018, 08:57:11 am »
Hi
Thanks for the response.

promoToolTip is my own function that builds the content of the dialog.
It receives strEmpCode and builds the content based on that value.
How to call a custom function in this way from a comment?

Cheers
Geoff

glt

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Show jQuery dialog onmouseover of a cell
« Reply #3 on: October 09, 2018, 02:13:03 am »
Hi PQ,

I made a jsfiddle to illustrate what I am trying to do:
https://jsfiddle.net/glt101/xpvt214o/872647/

Let me know if I can clarify this further.

Cheers,
Geoff

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Show jQuery dialog onmouseover of a cell
« Reply #4 on: October 09, 2018, 10:47:18 pm »
Your code is fine conceptually except 2 issues.

editAccount function needs to be in window scope and strID value should be passed.

https://jsfiddle.net/anh2L5pc/

glt

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Show jQuery dialog onmouseover of a cell
« Reply #5 on: October 11, 2018, 05:21:14 am »
Thanks PQ.
That was exactly what I needed.  :D

Cheers,
Geoff