Trying to add a link to a cell


I’m trying to add a column to a dhtmlXGridObject that links to a javascript method.

The code snippet where I create the dhtmlXGridObject:

atgrid = new dhtmlXGridObject("atgrid"); atgrid.setEditable(true); atgrid.setHeader("Name,Value,Unit,Last Value,Edit Value"); atgrid.setColumnIds("name,value,unit,lastvalue,editvalue"); atgrid.setInitWidthsP("30,20,20,20,20"); atgrid.setColTypes("edtxt,edtxt,edtxt,edtxt,link"); atgrid.loadXML("testxml.xml");

The xml file I’m using:

<?xml version="1.0" encoding="ISO-8859-1"?> <rows> <row id="123"> <cell>Price1</cell> <cell>123</cell> <cell>Testing</cell> <cell>456</cell> <cell>Link Title^javascript:showGrid()^_self</cell> </row> </rows>

When I run this I get a blank grid. If I remove the last column from the grid and remove the last from the xml then it works and displays the row.
Out of interest, in the xml I have tried changing the last to be:
<cell>Link Title^</cell>
but that also results in a blank grid.

Any ideas how to get the link to work?


Please, make sure that the dhtmlxgrid_excell_link.js is added to your page.