Is their a possibility to add the id attribute to the <TR> and assign a value from java to it. Actaully I need to display/ hide the row dynamically using javascript and I need the 'id' attribute for that. Any help will be greatly appreciated.
Thanks
Zafer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
has anyone managed to solve this problem? i also need to add an ID attribute to each <TR> element of the table to allow dynamic row selection using Javascript.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yea.. I have done this.. Actually.. it wld be better if u override addRowId method of display tag,Performce wise it wld b better than javascript.I am giving both the examples u can use any1 of ur choice..
Override addRowID()
<%request.setAttribute("dyndecorator", new org.displaytag.decorator.TableDecorator()
{
public String addRowId()
{
return "" + evaluate("rowId");
}
});%>
Here they have use concept of inner class rowID is any property u want to keep as id which wld b unique.. if not then set a bean property as a counter..just mention display:table decorator ="dyndecorator"
Using jaavscript
Thsi is however simple to understand bt u can check the perforemace.Basically this function wld go in onload f the page.
where detailRow is the id of the display table id attribute
var tab=document.getElementById('detailRow');
if(tab!=null){
var tbody = tab.getElementsByTagName("tbody")[0];
var tabRows=tbody.getElementsByTagName("tr");
Is their a possibility to add the id attribute to the <TR> and assign a value from java to it. Actaully I need to display/ hide the row dynamically using javascript and I need the 'id' attribute for that. Any help will be greatly appreciated.
Thanks
Zafer
has anyone managed to solve this problem? i also need to add an ID attribute to each <TR> element of the table to allow dynamic row selection using Javascript.
Yea.. I have done this.. Actually.. it wld be better if u override addRowId method of display tag,Performce wise it wld b better than javascript.I am giving both the examples u can use any1 of ur choice..
Override addRowID()
<%request.setAttribute("dyndecorator", new org.displaytag.decorator.TableDecorator()
{
public String addRowId()
{
return "" + evaluate("rowId");
}
Here they have use concept of inner class rowID is any property u want to keep as id which wld b unique.. if not then set a bean property as a counter..just mention display:table decorator ="dyndecorator"
Using jaavscript
Thsi is however simple to understand bt u can check the perforemace.Basically this function wld go in onload f the page.
where detailRow is the id of the display table id attribute
var tab=document.getElementById('detailRow');
if(tab!=null){
var tbody = tab.getElementsByTagName("tbody")[0];
var tabRows=tbody.getElementsByTagName("tr");