How do I display data with dataTable ?

>From my debug page the query is able to fetch one row of data, but why the 
>rowAvailable is false? How do I set it to true? Is this what cause my data is 
>not able to be displayed?

anonymous wrote : 
  | class        class org.jboss.seam.jsf.ListDataModel
  | dataModelListeners  []
  | rowAvailable        false
  | rowCount    1
  | rowData     java.lang.IllegalArgumentException[null]
  | rowIndex    -1
  | wrappedData         [EMAIL PROTECTED]
  | toString()  [EMAIL PROTECTED]
  | 
  | class        class org.jboss.seam.jsf.ListDataModel
  | dataModelListeners  []
  | rowAvailable        false
  | rowCount    1
  | rowData     java.lang.IllegalArgumentException[null]
  | rowIndex    -1
  | wrappedData         [EMAIL PROTECTED]
  | toString()  [EMAIL PROTECTED]
  | 


  | @Stateful
  | @Scope(ScopeType.SESSION)
  | @Name("supplierAction")
  | public class SupplierAction implements SupplierService, Serializable
  | {
  |     private static final long serialVersionUID = -3563521924777729108L;
  |     
  |     @PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager 
em;      
  |     @In private FacesMessages facesMessages;
  |     @Out @In(create=true) Supplier supplier;
  |     @DataModel List<Supplier> suppliers;
  |     @Logger private static Log log = Logging.getLog(SupplierAction.class);
  | 
  |     @Create @Begin(nested=true, pageflow="supplier")
  |     public void begin(){}
  |     
  |     @Restrict public void save()
  |     {
  |     log.debug("Supplier name = #0", supplier.getName());
  |     em.persist(supplier);
  |     facesMessages.add("Successfully saved");
  |     }
  |     
  |     public String search()
  |     {
  |     log.debug("Supplier name (in) = #0", supplier.getName());
  |     suppliers = 
(List<Supplier>)searchQuery(supplier.getName()).getResultList();
  |     
  |     Iterator iterator = suppliers.iterator();
  |     
  |     while(iterator.hasNext())
  |     {
  |         supplier = (Supplier)iterator.next();
  |         log.debug("Supplier name (out) = #0", supplier.getName());
  |     }
  |     
  |     return "searchSupplier";
  |     }
  |     
  |     public List<Supplier> getSuppliers()
  |     {
  |         return suppliers;
  |     }
  | 
  |     public void setSuppliers(List<Supplier> suppliers)
  |     {
  |         this.suppliers = suppliers;
  |     }
  | 
  |     public Query searchQuery(String name)
  |     {
  |      return em.createQuery("from Supplier s where s.name like 
:name").setParameter("name", name);
  |     }
  | 
  |     public void reset() {}
  |     
  |     @Remove @Destroy
  |     public void destroy() {}
  | }
  | 


  |     <f:subview rendered="#{!suppliers.rowAvailable}">
  |             <h:outputText value="#{messages['nodata']}"/>
  |     </f:subview>
  |     
  |     <f:subview rendered="#{suppliers.rowAvailable}">
  |     <h:outputText value="#{suppliers}" />
  |     <h:dataTable id="suppliers" value="#{suppliers}" var="supplier">
  |             <h:outputText value="#{supplier.name}" />
  |     </h:dataTable>
  |     </f:subview>
  | 

Have I missed out on something here?

Thanks in advance

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028227#4028227

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028227
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to