-
1. Dynamic columns inside a rich:datatable
boy18nj Apr 2, 2011 10:40 AM (in response to damntry)If it cannot see, make sure wraprow is well defined managed bean and you see in the logs when the server starts.
-
2. Re: Dynamic columns inside a rich:datatable
damntry Apr 5, 2011 3:19 AM (in response to boy18nj)Perhaps I didn´t understand you, but "wrapRow" is an item of the iteration from "myBean.wrapperRowList". It works fine when retrieving its attributes, the problem comes when I want to access a List inside wrapRow.
I need a way to iterate the variable that the datatable creates with each iteration (Basically a list of lists).
-
3. Re: Dynamic columns inside a rich:datatable
iabughosh Apr 5, 2011 4:41 AM (in response to damntry)Dear Mario,
try using a4j:repeat as the main iterator and insert rich:dataTable inside a4j:repeat like this :
<a4j:repeat value="#{table.tableData}"
var="row">
<rich:dataTable id="table"
value="#{row.beans}"
var="record"
rendered="#{somecondition}">
<rich:column>
<f:facet name="header">
<h:outputText value="Column 1" />
</f:facet>
<h:outputText value="#{record.desc}" />
</rich:column>
</rich:dataTable>
</a4j:repeat>
-
4. Re: Dynamic columns inside a rich:datatable
damntry Apr 5, 2011 9:47 AM (in response to iabughosh)Unfortunately that wouldn´t work in my case because the fixed, non dynamic colums needs to be inside a datatable, and your aproach would require that fixed columns have to be created between the a4j:repeat and the datatable.
Right now I´m still out of ideas, but as soon as I come up with something I´ll post here.
-
5. Re: Dynamic columns inside a rich:datatable
ilya_shaikovsky Apr 6, 2011 4:40 AM (in response to damntry)dynamic columns should be created with c:forEach and not repeat. I've already working on migrating the 3.3.x sample using c:forEach instead of columns. It's already working for me but requires additional features finishing prior to blog entry announcement and commit into showcase.
-
6. Re: Dynamic columns inside a rich:datatable
damntry Apr 6, 2011 7:11 AM (in response to ilya_shaikovsky)That´s intriguing ¿Is there a possibility that you could post some of that code here? I tried with c:forEach with no luck before. As far as I understand, JSTL tags are processed on tree construction so it won´t be able to "see" the var wrapRow, which comes from the iterating rich:datatable, it just doesn´t exist yet. ¿Am I wrong?
-
7. Re: Dynamic columns inside a rich:datatable
ilya_shaikovsky Apr 7, 2011 5:27 AM (in response to damntry)in my case table data columns set - separate variable in my case. (columns number fixed across all the rows). So I'm using:
<rich:dataTable value="#{dataModel}" var="obj" rows="15"
id="table">
<f:facet name="header">capt</f:facet>
<c:forEach items="#{bean.fields}" var="column">
<rich:column id="#{column}" sortBy="#{column}">
<f:facet name="header">
header
</f:facet>
<h:outputText value="#{obj[column]}"/>
</rich:column>
</c:forEach>
<f:facet name="footer">
<rich:dataScroller/>
</f:facet>
</rich:dataTable>
And if in your case column number is different for every row and you need to get info from the object itself about that - that not looks like a table structure. And you need to create markup on your own iterating usingnested repeats in that case. something like:
<table>
<a:repeat value=#{} var="ovj">
<tr>
<a:repeat value=#{obj.columns} var="cell">
<td>
#{cell.data}
</td>
<tr>
<table>
-
8. Re: Dynamic columns inside a rich:datatable
damntry Apr 7, 2011 6:57 AM (in response to ilya_shaikovsky)Now that I think about it you are right about it not being a valid table structure, but it would have been nice to be able to make it work somehow.
I´ll try the alternative aproach without datatable. Thanks Ilya.