Dynamic DataTable In SEAM2.2.0
psramkumar.ps.ramkumar.gmail.com Feb 22, 2011 6:53 PMhi, im in research of developing a dynamic DataTable using SEAM 2.2.0 please help me the last step
/// Use the below code for your xhtml/
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" > <ui:define name="body"> <rich:panel header="Model List Header"> <div> <rich:dataTable value="#{modelList}" var="model" width="750"> <!-- here is the List of Object --> <rich:columns value="#{columns}" var="column" index="ind" id="column#{ind}"> <!-- Here the List of private Member Variable List of that object--> <f:facet name="header">#{column}</f:facet> <!-- Printing all Field names as Table header--> <h:outputText value="#{'model.'.concat(column)}" /> <!-- Should print all the value--> </rich:columns> </rich:dataTable> </div> </rich:panel> </ui:define> </ui:composition>
// Use the below code in any of your Bean/
@Factory("columns") public List<String> columns(){ List<String> columns = new ArrayList<String>(); Class c = MediationFileDetail.class; for(Field field : c.getDeclaredFields()){ columns.add(field.getName()); } System.out.println(columns); return columns; } @Factory("modelList") public List<MediationFileDetail> fillModelList(){ List<MediationFileDetail> modelList = new ArrayList<MediationFileDetail>(); for(long i=1;i<20;i++){ MediationFileDetail mfd = new MediationFileDetail(i, i*100, i+"Name", i+"folder", "Date"+i, "Path"+i); modelList.add(mfd); } System.out.println(modelList); return modelList; }
below is the out put im getting now
id fileSize fileName fileDate fileModifiedDate fileOrginalPath
model.id model.fileSize model.fileName model.fileDate model.fileModifiedDate model.fileOrginalPath
model.id model.fileSize model.fileName model.fileDate model.fileModifiedDate model.fileOrginalPath
model.id model.fileSize model.fileName model.fileDate model.fileModifiedDate model.fileOrginalPath
i need to get the value some how