cancel
Showing results for 
Search instead for 
Did you mean: 

How can I select a row from a richList?

d_segato
Champ in-the-making
Champ in-the-making
hi there,
sorry if this is not the correct forum section to ask this but I didn't find one really suited.

I need to create a custom jsp within alfresco and i need to have a richList that allow me to select one or more row.

I have a List<Map<String,Object>> in my bean that get mapped by the var="r" of the alfresco richList.

one object of the map has key "selected" and is of type Boolean.

I've tried inserting a column with a checkbox and binding it to the value of the map. here an extract of code:
<a:richList id="locks-list" binding="#{LockManagerOpen.locksRichList}" viewMode="details" pageSize="#{LockManagerOpen.pageSizeLocks}" styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" 
         altRowStyleClass="recordSetRowAlt" width="100%" value="#{LockManagerOpen.locks}" var="r" refreshOnBind="true">

   <%– Selector –%>
                           <a:column id="col69" width="15" style="text-align:center">
      <f:facet name="header">
         <h:outputLabel id="col69-label" value="#{whiSkyMsg['skyit.locksystem.deletelock']}"/>
      </f:facet>
      <h:selectBooleanCheckbox id="col69-check" binding="#{r.selected}"/>
   </a:column>
                           
   <a:column id="col10" primary="true" width="250" style="padding:2px;text-align:left">
      <f:facet name="header">
         <a:sortLink id="col10-sort" label="#{msg.path}" value="path" mode="case-insensitive" styleClass="header" />
      </f:facet>
      <h:outputText id="col10-txt" value="#{r.path}" />
   </a:column>
</a:richList>

the selectBooleanCheckbox binding to #{r.selected} isn't resolved… I've debugged the code and it can't resolve "r"

this is the error I get when trying to load that JSP:
javax.faces.FacesException: Exception in JSP: /jsp/wcm/browse-locks.jsp:214

211: <f:facet name="header">
212: <h:outputLabel id="col69-label" value="#{whiSkyMsg['skyit.locksystem.deletelock']}"/>
213: </f:facet>
214: <h:selectBooleanCheckbox id="col69-check" binding="#{r.selected}"/>
215: </a:column>
216:
217: <%– Path del lock –%>


Stacktrace:
caused by:
org.apache.jasper.JasperException: Exception in JSP: /jsp/wcm/browse-locks.jsp:214

211: <f:facet name="header">
212: <h:outputLabel id="col69-label" value="#{whiSkyMsg['skyit.locksystem.deletelock']}"/>
213: </f:facet>
214: <h:selectBooleanCheckbox id="col69-check" binding="#{r.selected}"/>
215: </a:column>
216:
217: <%– Path del lock –%>


Stacktrace:
caused by:
javax.faces.el.PropertyNotFoundException: Base is null: r

stack trace doesn't help…
I can tell you that it try to resolve the Base "r" with org.alfresco.web.app.AlfrescoVariableResolver and it doesn't succeed

Am I doing anything wrong?

Is there another way to select rows from the list?

Or is my only option trying to merge a:selectList with a:richList ?

Regards,
Daniele
3 REPLIES 3

compaqnx7300
Champ in-the-making
Champ in-the-making
I have very similar problem. Is it possible to input/modify data by <a:richList …> ?

ganeshkolhe
Champ in-the-making
Champ in-the-making
You can pass row id as parameter in backing bean and can get full row.

<h:panelGrid id="check-grid2">
<h:selectBooleanCheckbox  value="#{r.checkBox}"  valueChangeListener="#{search.changeData}" >
   <a4j:support id="renderchkBox2" event="onclick" reRender="check-grid2">
    <a4j:actionparam value="#{r.rowid}" name="rowidentifier"/>
    </a4j:support>
</h:selectBooleanCheckbox>
</h:panelGrid>

and your backing bean method changeData() can be as

public void changeData(ValueChangeEvent arg0){
       FacesContext context = FacesContext.getCurrentInstance();
        String rowidentifier= context.getExternalContext().getRequestParameterMap().get("rowidentifier").toString();
       //put the logic to get row on the basis of rowidentifier.     
    }

compaqnx7300
Champ in-the-making
Champ in-the-making
It does not work Smiley Sad
I decided to use <h:dataTable…/> instead, where <h:selectBooleanCheckbox…> works correct. But it is not the best solution.