1

I am working with JSF2.0, Spring-Webflow2.3.1 and richfaces4.2.3. I have got a rich:extendedDataTable which will show a list of data(There is no button present inside it). I need to implement ->

  • double click on a row to get the details in a separate screen.

  • Select a row and click on "View Details" button, which will also show me the details in the separate screen.

I am able to take out the row id, but i need to get the id field provided in the object to fetch the data. How will i make this possible using spring-webflow.

Ahmed Nabil
  • 17,392
  • 11
  • 61
  • 88
jijo thomas
  • 337
  • 2
  • 5
  • 13

1 Answers1

0

Here is a sample example as the second requirement
Select a row and click on "View Details" button, which will show the details in the separate screen.
I assume that

  1. Your pojo Class name is "YouPojoClass.java"
  2. Your pojo Class have (member1,member2,code) fields
  3. Your data set of extendedDataTable will be get from yourFirstController.rowVariableList "List of YouPojoClass"
  4. Your first page controller name "yourFirstController.java"
  5. Your second page name is "secondPage.xhtml"

// In your first page screen

<rich:extendedDataTable id="rowVariablepliersTable"
    value="#{yourFirstController.dataModel}" var="rowVariable">

    <rich:column width="300px">
        <f:facet name="header">
            <h:outputText value="member1" />            
        </f:facet>
        <h:outputText value="#{rowVariable.member1}" />
    </rich:column>

    <rich:column width="300px">
        <f:facet name="header">
            <h:outputText value="member2" />            
        </f:facet>
        <h:outputText value="#{rowVariable.member2}" />
    </rich:column>

    <rich:column width="90px">
        <f:facet name="header">
            <h:outputText value="view" />
        </f:facet>
        <h:commandButton 
            title="view" 
            value="view"
            action="#{yourFirstController.edit(rowVariable)}"/>
        </h:commandButton>
    </rich:column>
</rich:extendedDataTable>

// In your first page controller

public String view(YouPojoClass rowVariable) {      
    Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    requestMap.put("SELECTED_ITEM_ID", rowVariable.getCode());  
    return "secondPage";
}  

// In your second page controller

public void postConstruct() {
    Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    String SELECTED_ITEM_ID = requestMap.get("SELECTED_ITEM_ID");
    // .....
}
Ahmed Nabil
  • 17,392
  • 11
  • 61
  • 88
  • Thanks for your quick response. But, there is no button within the datatable, there is only a single button ("view Details") outside the rich:extendedDataTable. – jijo thomas Mar 09 '13 at 08:55
  • Then your `selectionMode` property of your `extendedDataTable` must be `single` – Ahmed Nabil Mar 09 '13 at 09:00
  • As per your implementation, each row will have one `h:commandButton`and the action is made through this button. But for me no such button should be used. :( Also, here i should use `yourPojoClass.id` as the `selectedRowId`. – jijo thomas Mar 09 '13 at 09:08