Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Udaya on Jun 05, 2008 03:14
open dhtmlx forum
Regarding calling a javascript method onclick of a link in the Grid.....

Hi,
iam using the DHTMLX grid which has a column type as link.What i want to do is to call a javascript method onclick of that column value,which in turn opens a pop up window.
1.Can you please tell me how to invoke a javascript method onclick of that value
2.How to infer that in the XML(holds the content of the grid)
3.How to pass that link value to the same javascript method



With Regards,
Udaya.R

Support, posted: Jun 05, 2008 01:47 | Direct link: http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=3556&a=4939

There are two way
a) encode action directly in link value
<cell>Label^javascript:myCustomCode('Label')^_self</cell>

b) use onRowSelect method of grid ( basically it will be called on each click inside the grid )

<cell>Label</cell>
...
grid.attachEvent("onRowSelect",function(id,ind){
if (ind == index_of_link_column)
myCustomCode(id,ind); // by knowing ID and ind any info related to cell can be retrieved
return true;
})

udaya, posted: Jun 05, 2008 03:05 | Direct link: http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=3556&a=4944




I tried this method..but the thing is iam dynamically writing the XML from a java class,storing the entire data as a string and accessing that from a jsp.This is where iam initializing my grid and want to invoke a js method called

function openManageScreen(elem)

{alert(elem);}

Iam writing the XML as

<cell>100"^javascript:openManageScreen('100')^self</cell>

Can you please guide me.

the error i get is teling like - openManageScreen is not defined
Answer posted by Support on Jun 05, 2008 08:19