-
1. Re: rich:datatable header and footer in BB
nbelaevski Nov 4, 2008 1:08 PM (in response to mrfarhankhan)Farhan,
Use
javax.faces.component.UIComponentBase.getFacet(String) with header/footer argument -
2. Re: rich:datatable header and footer in BB
mrfarhankhan Nov 5, 2008 1:33 AM (in response to mrfarhankhan)Thanks fot the response. I am using the following code (cut down for readability) but only able to get the id but no other attibute. All other attributes return null. I want to get the col value.
<f:facet name="header">
<rich:columnGroup>
<rich:column label="#{msg.cntry_th_country_no}">
<h:outputText value="#msg.cntry_th_country_no}" />
</rich:column>
</rich:columnGroup> </f:facet>
UIColumnGroup cg = (UIColumnGroup)table.getFacet("header");
Iterator iterr = cg.columns();
while(iterr.hasNext()) {
HtmlColumn col = (HtmlColumn)iterr.next();
Iterator iterCol = col.getChildren().iterator();
while(iterCol.hasNext()) {
HtmlOutputText text = (HtmlOutputText)iterCol.next();
System.out.println("================= Text val = " + text.getValue());
}
System.out.println(">>>>>>>>>>>>>>>>>" + col.getLabel() + " - " + col.getTitle() + " - " + col.getFilterValue() + " - " + col.getLang() + " - " + col.getDir() + " - " + col.getId());
} -
3. Re: rich:datatable header and footer in BB
nbelaevski Nov 5, 2008 6:08 AM (in response to mrfarhankhan)Please provide full page source code: what is "msg" var?
-
4. Re: rich:datatable header and footer in BB
mrfarhankhan Nov 5, 2008 7:28 AM (in response to mrfarhankhan)It would be more confusing if i paste the full source here because there are quite a few things on this page. msg is the variable for the property file from which we load the labels. You can read the snippet as
<f:facet name="header">
<rich:columnGroup>
<rich:column label="Country No">
<h:outputText value="Country No" />
</rich:column>
</rich:columnGroup>
</f:facet>
Prompt response is appreciated
Thanks
Farhan ! -
5. Re: rich:datatable header and footer in BB
nbelaevski Nov 5, 2008 11:05 PM (in response to mrfarhankhan)Ok, please let me clarify:
1. Is msg iteration variable of data table or not?
2. From where do you try to access column attributes (you can copy and paste stack trace from debugger stopped on breakpoint)? -
6. Re: rich:datatable header and footer in BB
mrfarhankhan Nov 5, 2008 11:47 PM (in response to mrfarhankhan)Ans1. Message is not the iteration variable rather its just a property file to make our application support multilingual. There is nothing wrong with the msg variable.
Ans2. I'm trying to access the column attributes from my backing bean.
There is no exception ! Only the values return null !
My datatable looks like this
================================================
<rich:dataTable rows="10" binding="#{manageCountriesBB.table}" var="searchedCountries" id="searchedCountriesList" value="#{manageCountriesBB.searchedCountriesList}">
<f:facet name="header">
<rich:columnGroup>
<rich:column id="No">
<h:outputText value="#{msg.cntry_th_country_no}" />
</rich:column>
<rich:column id="Country_Name">
<h:outputText value="#{msg.cntry_th_country_name}" />
</rich:column>
<rich:column id="Country_Code">
<h:outputText value="#{msg.cntry_th_country_code}" /> </rich:column> </rich:columnGroup> </f:facet> <rich:columnGroup> <rich:column> <h:outputText value="#{manageCountriesBB.countCountries}" /> </rich:column> <rich:column> <h:outputText value="#{searchedCountries.name}" /> </rich:column> <rich:column> <h:outputText value="#{searchedCountries.code}" /> </rich:column> </rich:columnGroup> </rich:dataTable>
================================================
I am using the following code in my Backing bean
UIColumnGroup cg = (UIColumnGroup)table.getFacet("header");
Iterator iterr = cg.columns();
while(iterr.hasNext()) {
HtmlColumn col = (HtmlColumn)iterr.next();
Iterator iterCol = col.getChildren().iterator();
while(iterCol.hasNext()) {
HtmlOutputText text = (HtmlOutputText)iterCol.next();
System.out.println("================= Text val = " + text.getValue());
}
System.out.println(">>>>>>>>>>>>>>>>>" + col.getLabel() + " - " + col.getTitle() + " - " + col.getFilterValue() + " - " + col.getLang() + " - " + col.getDir() + " - " + col.getId());
}
================================================
All the values printed in the above System.out. are null except the col.getId()