ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: glt on October 05, 2018, 06:36:55 am

Title: Show jQuery dialog onmouseover of a cell
Post by: glt 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
Title: Re: Show jQuery dialog onmouseover of a cell
Post by: paramvir 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
Title: Re: Show jQuery dialog onmouseover of a cell
Post by: glt 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
Title: Re: Show jQuery dialog onmouseover of a cell
Post by: glt 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
Title: Re: Show jQuery dialog onmouseover of a cell
Post by: paramvir 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/
Title: Re: Show jQuery dialog onmouseover of a cell
Post by: glt on October 11, 2018, 05:21:14 am
Thanks PQ.
That was exactly what I needed.  :D

Cheers,
Geoff