Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get row index in a dynamic table?

 
Akaine Harga
Ranch Hand
Posts: 99
Java MyEclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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
 
Akaine Harga
Ranch Hand
Posts: 99
Java MyEclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolved using a4j:actionparam

 
Akaine Harga
Ranch Hand
Posts: 99
Java MyEclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
Java MyEclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOLVED

P.S. EL rules!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic