Note that there are some explanatory texts on larger screens.

plurals
  1. POBinding primefaces dataTable with org.primefaces.component.datatable.DataTable;
    primarykey
    data
    text
    <p>I have a question regarding primefaces datatable component. I want to bind a DataTable variable to the p:dataTable so that I would be able to manipulate the first, rows, rowsPerPageTemplate, etc. programmatically from the backing bean. But I'm stuck and keep getting java.lang.String cannot be cast to javax.faces.component.UIComponent.</p> <p>Here's my p:dataTable declaration.</p> <pre><code>&lt;p:dataTable id="dtProductCategoryList" value="#{saProductCategoryController.saproductcategories}" rowsPerPageTemplate="#{appConfig.rowsPerPageTemplate}" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" currentPageReportTemplate="{currentPage} #{bundle.DataTablePageSeparator} {totalPages}" paginatorAlwaysVisible="false" var="item" paginator="true" rows="#{appConfig.rowsPerPageDefault}" binding="saProductCategoryController.dtProductCategory"&gt; </code></pre> <p>And here's my ViewScoped backing bean. </p> <pre><code> private DataTable dtProductCategory; /** Creates a new instance of saProductCategoryController */ public SaProductCategoryController() { } @PostConstruct public void Init() { try { dtProductCategory = new DataTable(); //dtProductCategory. saproductcategories = saProductCategoryFacade.selectAll(); LogController.log.info("Creating postconstruct for saProductCategoryController"); } catch (Exception ex) { LogController.log.fatal(ex.toString()); } } </code></pre> <p>What could be the problem? It seems that the DataTable variable is mistaken for a String?</p> <p>Appreciate all your help. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload