aspose file tools*
The moose likes JSF and the fly likes how to add HR tag between rows when using datatable??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "how to add HR tag between rows when using datatable???" Watch "how to add HR tag between rows when using datatable???" New topic
Author

how to add HR tag between rows when using datatable???

gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
Hi All,

I am using datatable.
i want to add <hr> between rows. since datatable provides only <h:column>
i dont know how to add <hr> between the rows.

please let me know, how to do this.


thanks in advance
Gopal
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
If you want to use the hr tag to show a line separating each row you might want to look into style sheets and set a row style sheet that creates the same effect.
gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
Hi Gerardo,

I tried to add style sheet for row but it is showing , so i tried to add for columns its works ok not so good.

Actually i want to display "--" if there is no value in the column

eg: empno empname age
101 A --
102 -- 26

i dont know how to set this "--".

please let me know how to do this.

thanks in advance
Gopal
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Ok I'm assuming that by no value you mean null. Please change the validation accordingly if it is not.

The following should work

<h:column>
<h utputText value="--" rendered="#{controlAdmin.testValue==null}"></h utputText>
<h:inputText value="#{controlAdmin.testValue}" rendered="#{controlAdmin.testValue!=null}"></h:inputText>
</h:column>

It has two outputs inside the column tag. One is an inputText and one is an outputText. Only one will be displayed depending on the value of rendered="".

The first tag compares the controlAdmin.textValue variable against null. If it is null it renders the outputText (showing "--"). Hence the second (the inputText) isn't rendered since it's test is against NOT null. So when not null the variables value is shown.

Change controlAdmin for whatever you put in var under dataTable and you should be ready to go. Change inputText to outputText too.

Cheers,
Jerry
gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
Hi Gerardo,

Thank you so much.

It works fine. i am getting the desired output as i wish(--).

Thanks a lot.
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
You're welcome.
 
 
subject: how to add HR tag between rows when using datatable???
 
Similar Threads
Print new rows in dataTable
h:selectBooleanCheckbox
datatable iteration
how to add HR tag between rows when using datatable???
datatable renders empty rows