0 Replies Latest reply on Dec 28, 2012 2:19 AM by 689245

    Datatable selected row not available when user selects for first time


      In my managed bean I have @ViewAccessScoped, I have noticed that when user selects a row from a datatable for the first time, the selected row is not available in managed bean, however for subsequent selections, selected row value is available in managed bean.

      If I use session scope, then for the first time itself I am able to get the selected row value.

      What could be the reason for this?
      public class EmployeeManagedBean implements Serializable {
      private Employee selectedRequest = new Employee();
         public void init() {
         private void initTable() {
            lazyModel = new LazyEmployeeDataModel(requestList, requestService);
         public LazyDataModel<Employee> getLazyModel() {
            return lazyModel;
      and onRowSelect Method
      public void onRowSelect(SelectEvent event) {
            try {
               setSelectedRequest((Employee) event.getObject());
               System.out.println("row "
                     + getSelectedRequest()); 
      JSF Code
      <p:dataTable id="dataTable" var="req" lazy="true" value="#{emp.lazyModel}"
               paginator="true" rows="10"
            <p:ajax event="rowSelectRadio" listener="#{emp.onRowSelect}" /> 
             <p:column selectionMode="single" style="width:18px" />