hello,
i have a templatecolumn containing a checkbox as its celltemplate in the grid. i add rows to this grid on the client. while adding rows, when i am at this templatecolumn cell i do - ele=row.getCell(3).Element; $addHandler(ele,"click",SelectRow); . the SelectRow function expects the checkbox object as its parameter, so that to check whether the checkbox is checked or unchecked. but it seems that i get some other object other that the checkbox in the SelectRow when it is invoked. i tried ele=row.getCell(3).Element.children[0] too.
regards,
Great - thanks for sharing the solution in public forums -- I am sure it will be appreciated by a lot of developers. Just to help other peolpe if they come upon this thread -- the client side object model (CSOM) Infragistics WebGrid uses is fully documented here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebGrid_CSOM.html
anyway i didnt get to use the parameter object but i found getActiveRow() function which worked for me instead. so my handler looked as follows.
function SelectRow(objtd)
{
var grid=igtbl_getGridById(gridsclientid);
if (grid.getActiveRow()!=null)
var row = grid.getActiveRow();
for(i=4; i<row.cells.length; i++)
if(row.getCell(3).getValue()=="true")
row.getCell(i).setValue("true");
else
row.getCell(i).setValue("false"); }}}
regards.
Did you try
ig_getWebControlById("whatever")?
i tried using getElementsByTagName("INPUT")[0] with the object paramerter that i receive in SelectRow handler but it gave me the error as "object doesnt support this property or method". it doesnt support object.id too.i do not understand what kind of object i get in it.
as i do not understand the object i receive, i cannot get the row from it. i just want to somehow traverse the whole row to checkout the other checkboxes in the same row.
<CellTemplate>
<input type="checkbox" onclick="SelectRow()" .. />
</CellTemplate>
i tried the above code too but it doesnt work, i think because the rows in that grid are added on the client with javascript. this is why i resorted to $addHandler() for the cell element but it gives me the problem which i have mentioned earlier.
regards
Hello,
In this case SelectRow most probably receives as a parameter the Element of the cell which is a <td> element. I can suggest going down from this element and using
getElementsByTagName("INPUT")[0]
to get the first checkbox, or directly hooking the event on the checkbox in the template, e.g
this way, the reserved keyword "this" will have the instance of the checkbox inside the event handler.
Hope this helps.