Samet Dağ
Samet Dağ

Reputation: 113

Pass parameter from Primefaces sheet to backing bean

I want to pass parameters from primefaces sheet column to jsf backing bean like below.

 <pe:sheetcolumn headerText="HTS Chapter" value="#{material.htsChapter}" colWidth="100"
                                                rendered="true"
                                                colType="dropdown"
                                                readonlyCell="#{!itemActionsManagedBean.authCheckForEditForHtsChapter(material.country)}"
                                                selectItems="#{itemActionsManagedBean.getMapItemsForHtsChapter(material.country)}"/>

I can pass parameters via readonlyCell attribute. But with selecitems it doesnt pass parameters to backing bean. Its always passing null for selectitems. My scope is @ViewScoped.

JSF: 2.2.1, PrimeFaces: 12.0.0, PrimeFaces Extensions: 12.0.5

Upvotes: 1

Views: 107

Answers (1)

Melloware
Melloware

Reputation: 12039

SelectItems is NOT called per row its called once for the whole column and ReadOnly is evaluated per row that is the difference. SelectItems cannot be different per row which for performance is why its called only once so NULL is expected as you are not in "context" of a row. So material.country is NULL when SelectItems is called because material is your ROW which is not even evaluated yet.

Upvotes: 1

Related Questions