ZIVEM
asked on
Is it possible to iterate through DataGrid Items with JavaScript ?
how can this be accomplished ?
Whenever any tabular data are displayed on a page, it is possible to iterate through them using JS. However, the exeact implementation depends on where the component came from. Which DataGrid are you using? Something MS created? From JSF? You see the source of the component determines the exact markup that's displayed. If you could paste the generated source of the datagrid, it would help identify what to access.
ASKER
i get table with TR and TD's like this one.
my Grid has first and last names.
<table cellspacing="0" cellpadding="3" rules="all" border="1" id="MyDataGrid" style="border-color:Tan;fo nt-family: Arial;font -size:9pt; width:800p x;border-c ollapse:co llapse;">
<tr style="color:White;backgro und-color: #336699;fo nt-weight: bold;">
<td align="center">Edit</td><t d align="center">Delete</td> <td><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 2$ctl00',' ')" style="color:White;">id</a ></td><td> <a href="javascript:__doPostB ack('MyDat aGrid$ctl0 2$ctl01',' ')" style="color:White;">First Name</a></td><td><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 2$ctl02',' ')" style="color:White;">Last Name</a></td><td><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 2$ctl03',' ')" style="color:White;">permi ssion</a>< /td>
</tr><tr style="background-color:#E EEEEE;">
<td align="center" style="width:70px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 3$ctl00',' ')"><img src='gui/icon/application_ form_edit. gif' border=0 /></a></td><td align="center" style="width:40px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 3$ctl01',' ')"><img src='gui/icon/application_ form_delet e.gif' border=0 /></a></td><td valign="top" style="white-space:nowrap; ">71</td>< td>
john
</td><td>
weis
</td><td>
1
</td>
</tr><tr style="background-color:#E EEEEE;">
<td align="center" style="width:70px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 4$ctl00',' ')"><img src='gui/icon/application_ form_edit. gif' border=0 /></a></td><td align="center" style="width:40px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 4$ctl01',' ')"><img src='gui/icon/application_ form_delet e.gif' border=0 /></a></td><td valign="top" style="white-space:nowrap; ">60</td>< td>
Dan
</td><td>
Kerr
</td><td>
1
</td>
</tr><tr style="background-color:#E EEEEE;">
<td align="center" style="width:70px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 5$ctl00',' ')"><img src='gui/icon/application_ form_edit. gif' border=0 /></a></td><td align="center" style="width:40px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 5$ctl01',' ')"><img src='gui/icon/application_ form_delet e.gif' border=0 /></a></td><td valign="top" style="white-space:nowrap; ">70</td>< td>
Cristian
</td><td>
Luxford
</td><td>
2
</td>
</tr><tr style="background-color:#E EEEEE;">
<td align="center" style="width:70px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 6$ctl00',' ')"><img src='gui/icon/application_ form_edit. gif' border=0 /></a></td><td align="center" style="width:40px;"><a href="javascript:__doPostB ack('MyDat aGrid$ctl0 6$ctl01',' ')"><img src='gui/icon/application_ form_delet e.gif' border=0 /></a></td><td valign="top" style="white-space:nowrap; ">54</td>< td>
Ben
</td><td>
Turner
</td><td>
3
</td>
</tr><tr align="right" style="background-color:#C 6C3C6;font -size:Smal ler;">
<td colspan="6"><span>1</span> <a href="javascript:__doPostB ack('MyDat aGrid$ctl0 8$ctl01',' ')">2</a>< /td>
</tr>
</table>
my Grid has first and last names.
<table cellspacing="0" cellpadding="3" rules="all" border="1" id="MyDataGrid" style="border-color:Tan;fo
<tr style="color:White;backgro
<td align="center">Edit</td><t
</tr><tr style="background-color:#E
<td align="center" style="width:70px;"><a href="javascript:__doPostB
john
</td><td>
weis
</td><td>
1
</td>
</tr><tr style="background-color:#E
<td align="center" style="width:70px;"><a href="javascript:__doPostB
Dan
</td><td>
Kerr
</td><td>
1
</td>
</tr><tr style="background-color:#E
<td align="center" style="width:70px;"><a href="javascript:__doPostB
Cristian
</td><td>
Luxford
</td><td>
2
</td>
</tr><tr style="background-color:#E
<td align="center" style="width:70px;"><a href="javascript:__doPostB
Ben
</td><td>
Turner
</td><td>
3
</td>
</tr><tr align="right" style="background-color:#C
<td colspan="6"><span>1</span>
</tr>
</table>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that's great!
thanks
thanks