call javascript when onclick a record

Questionscall javascript when onclick a record
Barry asked 6 years ago

Hi,

I want to do call a popup javascript when click on a column data. Can I do it using $col["link"] = 'javascript: popup(id);' ?

Please advise. Thanks.

Regards,
Barry

6 Answers
Abu Ghufran answered 6 years ago

Hello,

Yes this is doable. For e.g.

$col["link"] = 'javascript:window.open("http://www.google.com/?q={name}","newwind","height=500,width=800"); void(0);';

Latest build might be required, as it is recently fixed/added.

Barry answered 6 years ago

Hi,

The example not work. Below is my code. I just got the premium version.

$col["link"] = "javascript:window.open('google.com','new window','height=500,width=800'); void(0);";

It open blank page only. My firefox status bar show "javascript:window.open(" only. The url is not complete and get SyntaxError: syntax error @ javascript:window.open(:1

Please advise. Thanks.

Regards,
Barry

Abu Ghufran answered 6 years ago

Hello,

Barry, i just emailed you latest build.
Should work after that.

Regards,

Barry answered 6 years ago

It works now but I have another issue.
I have one column that some row have data but some is null. Then the grid column display 'undefine' on the null row. The free version is showing empty instead of this. How to show blank instead of 'undefine'? Thanks.

Barry answered 6 years ago

I guess because I use the link. Code below for your reference.

$col = array();
$col["title"] = "Name";
$col["name"] = "name";
$col["width"] = "12";
$col["search"] = true;
$col["sortable"] = true;
$col["link"] = "detail.php?id={id}";
$col["linkoptions"] = "target='_blank'";
$cols[] = $col;

Abu Ghufran answered 6 years ago

I've emailed you the fix.

Your Answer

2 + 6 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!