aspose file tools*
The moose likes JSF and the fly likes How to get row index in a dynamic table? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to get row index in a dynamic table?" Watch "How to get row index in a dynamic table?" New topic
Author

How to get row index in a dynamic table?

Akaine Harga
Ranch Hand

Joined: Nov 03, 2009
Posts: 80

(This is an update of my early post with more clear explanation)

Hi

I have a fully dynamic table based on rich:dataTable like this:

What I need is to be able to get both row and col ids in commandLink (or to be able to know which cell called the bean.testAction method inside my backing bean). Here's what happens when I try to print out / render the whole thing:

- in <h:inputText value="#{rowData.someProperty}" id="rowId_#{row}" /> the id is printed out (in console) as "rowId_";
- <h: outputText value="#{row}"></h: outputText> renders the local variable correctly and I CAN see the actual row index (this serves me little since I need to see it in my backing bean and not on the page);
- in <a4j: commandLink value="Some Action" id="someAction_#{row}_#{col}" actionListener="#{bean.testAction}" /> the id is printed out (in console) as "someAction__0" (or any other actual col index, while the row index is just ignored);

Just to make myself even more clear here goes the testAction method:

1. So... any ideas why col is printed out correctly and row isn't? And if row is ignored in ids why is it rendered correctly when I put it as a rendered value?
2. Is there any other way to get the action caller "coordinates" from the bean.testAction method?

Thanks


Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
willCodeForFood("Java,PHP,C#,XML,VBS,XHTML,CSS,JavaScript,SQL"); //always looking for job opportunities in AU/NZ/US/CA/Europe :P
Akaine Harga
Ranch Hand

Joined: Nov 03, 2009
Posts: 80

Resolved using a4j:actionparam

Akaine Harga
Ranch Hand

Joined: Nov 03, 2009
Posts: 80

Here goes the Fight Round #2:

Let's consider the earlier code with modification in value attribute of the secondary rich:dataTable:

Considering that each element of someRowDataList contains someColumnDataList which in its place contains someSubDataList. What I want is to display someSubDataList of a particular cell.

All the structure is filled properly. I get no rendering error. Still I get nothing in the cells...
Akaine Harga
Ranch Hand

Joined: Nov 03, 2009
Posts: 80

SOLVED

P.S. EL rules!
 
Don't get me started about those stupid light bulbs.
 
subject: How to get row index in a dynamic table?