Is it possible to progrmmatically generate id for the <tr>
in datatable?
views:
65answers:
1
A:
Override the renderer associated with UIData
component.
It's only fairly a lot of work and I don't have the impression that you're skilled enough to do that. I think it's better to elaborate more about the problem / functional requirement for which you thought that this is the solution, so that we can suggest better (more correct) solutions for what you're trying to achieve.
BalusC
2010-01-26 11:52:51
I am trying to achieve the expand/contract functionality of table rows in JSF using core faces implementation. As Balus mentioned in one of my earlier thread this is not straight forward to achieve in core faces implementation. So, i thought of using HTML + JQUERY to achieve the functionality. I am calling the row with +/- gif as parent row and the rows that are to be expanded and contracted are its child rows. To make parent aware of which child it needs to show or hide, I am making use of jquery and assigning row id to each <tr>.
Nrusingha
2010-01-26 16:50:31
In continuation to my earlier comment aboveif the parent row-id="row1234", then, the child row will have row-id="row1234-child". here is the code, you would require JQuery library to run this.Jquery code:============<script src="jquery.js"></script><script>$(document).ready(function(){$('.expand').click(function() {if( $(this).hasClass('.hidden') ){$(this).attr("src", "plus.gif");}else{$(this).attr("src", "subtract1.gif");}$(this).toggleClass('hidden');$(this).parent().parent().siblings('#'+$(this).parent().parent().attr('id')+'-child').toggle();});});</script>
Nrusingha
2010-01-26 16:54:05
Here is the HTML code=====================<TR class="parent" id="row123" style="cursor: pointer; " title="Click to expand/collapse"><TD>123</TD><TD colspan="2"><img class="expand" src="plus.gif"/>ABC</TD><TD>100</TD></TR><TR ID="row123-child" style="display: none; "><TD> </TD><TD>2007-01-02</TD><TD>A short description</TD><TD>15</TD></TR><TR ID="row123-child" style="display: none; "><TD> </TD><TD>2007-02-03</TD><TD>Another description</TD><TD>45</TD></TR><TR ID="row123-child" style="display: none; "><TD> </TD><TD>2007-03-04</TD><TD>More Stuff</TD><TD>40</TD></TR>
Nrusingha
2010-01-26 16:57:01
Better edit your question with udpated information instead of posting it as comment(s). It's now one and all unreadability.
BalusC
2010-01-26 17:25:16
Reframed the question and posted it. You can view it at http://stackoverflow.com/questions/2142341/generate-id-for-row-in-jsf-datatable. Thanks for taking time out and replying to my queries. Appreciate the same.
Nrusingha
2010-01-26 20:23:02