This content has been marked as final.
Show 4 replies
-
1. Re: Render dataTable via a hashMap
bbasdeo Aug 4, 2009 6:40 AM (in response to bbasdeo)Any idea on the above?
-
2. Re: Render dataTable via a hashMap
bbasdeo Aug 4, 2009 8:19 AM (in response to bbasdeo)How would i access a list of classes from a hashmap to render the list into columns?
Structure of the hashmap: Map<String,List< LmsLeavesRequests>> leavesRequestPerEmployee
the lst has to be rendered into the dataTable control. How could the class be accessed along with its attributes?
With thanx
Neerou -
3. Render a list having various items in a list
bbasdeo Aug 6, 2009 1:20 AM (in response to bbasdeo)<rich:dataTable id="requestTable" border="0" var="requests" rendered="#{not empty leavesRequestPerEmployee}" value="#{leavesRequestPerEmployee}"> <h:column> <h:outputText value="#{requests.key}" /> </h:column> <rich:dataTable value="requests.value" var="values"> <h:column> <h:outputText value="#{values.lvrReason}" /> </h:column> </rich:dataTable> </rich:dataTable>
@DataModel private Map<String,List< LmsLeavesRequests>> leavesRequestPerEmployee;
@SuppressWarnings("unchecked") @Factory("leavesRequestPerEmployee") public void findRequests(){ try{ Query query = entityManager .createQuery("select lmsLeavesRequests from LmsLeavesRequests lmsLeavesRequests"); List<LmsLeavesRequests> listRequests=query.getResultList(); leavesRequestPerEmployee = new LinkedHashMap<String, List<LmsLeavesRequests>>(); for (LmsLeavesRequests lmsLeavesRequests :listRequests ) { String usrLogin = lmsLeavesRequests.getLmsUsersByLvsUsrId().getUsrLogin(); if(leavesRequestPerEmployee != null && leavesRequestPerEmployee.containsKey(usrLogin)){ //append requests //leavesRequestPerEmployee.put(lmsLeavesRequests.getLmsUsersByLvsUsrId().getUsrLogin(), lmsLeavesRequests.getLmsLeaves()); List<LmsLeavesRequests> requestlst = new ArrayList<LmsLeavesRequests>(); requestlst.add(lmsLeavesRequests); List <LmsLeavesRequests> listToBeAppended = leavesRequestPerEmployee.get(usrLogin); listToBeAppended.add(lmsLeavesRequests); leavesRequestPerEmployee.put(usrLogin,listToBeAppended); }else{ //create new hash key and value List<LmsLeavesRequests> requestlst = new ArrayList<LmsLeavesRequests>(); requestlst.add(lmsLeavesRequests); leavesRequestPerEmployee.put(usrLogin,requestlst); } } }catch(Exception e){ e.printStackTrace(); e.getMessage(); } }
The list "requestlst" value of hashmap, can contain different objects of the LeaveRequest object. how is it possible to render all items of the list. -
4. Re: Render dataTable via a hashMap
nbelaevski Aug 6, 2009 5:52 AM (in response to bbasdeo)Hi,
You can usevalue="#{leavesRequestPerEmployee['className']}"
to render some class