I am initializing a grid using loadXML, this default loaded grid work fine, but when a add a row with the next code:
mygrid.addRow(Idx,’[AUTO],<IMG alt=“SETI” src="…/temas/botones/exclamation.png" width=“16” height=“16” border=“0”^javascript:eliminar(“0”)^_self>’,nrow);
add a row corectly displayed but the click event on image open a new window whit a URL=javascript:eliminar(“0”)
on the other hand the same image in previously loaded grid work fine executing the function eliminar(“0”).
So the question is how can i do to put an image on a grid using addRow() capable of trigger a javascript function?
thanks in advance.
Sorry about my english.!
There are multiple ways to provide javascript actions from cell, the most simple - just use plain HTML as cell value
mygrid.addRow(some_id,[1,"<img src=‘some.gif’ onclick=‘doSome();’,2] />");
Others are next
a) Use “link” excell and formated data
Text^javascript:Action^_self
Delete Alert?^javascript:confirmDelete(“some”)^_self
such code will create an A tag, with javascript action attached to it
b) Use “ro” excell and HTML value
<![CDATA[Text]]>
<![CDATA[Delete Alert?]]>
c) Use the setOnRowSelectHandler method
grid.setOnRowSelectHandler(my_func,true);
function my_func( rowId, cellIndex){
if (cellIndex==some_index)
confirmDelete(“some”)
}
d) create a custom excell