Hi Volker,
Sorry for late reply,
i have been trying to achieve my requirement by using the idea you provided
in last mail. but in vain.
im not able to under stand the logic.
Here is my logic
I have included my questions as comments in the code itself.
__________________________________________________________________________________________________
public UIComponent getSheet() {
InventoryItem[] itemsList = objectA.getProductCatalog();
FacesContext facesContext = FacesContext.getCurrentInstance();
UIData sheet = (UIData) ComponentUtil.createComponent(facesContext,
UIData.COMPONENT_TYPE,TobagoConstants.RENDERER_TYPE_SHEET);
sheet.setId("sheet");
sheet.setVar("itemsList");
for(int i=0;i<noOfColumns; i++) {
UIColumn column =
(UIColumn)ComponentUtil.createComponent(facesContext,UIColumn.COMPONENT_TYPE
,null);
column.setId("column_"+i);
sheet.getChildren().add(column);
//ToDo: Which component should i include here?
//need to display following values in each row of the sheet
/**
* itemsList[i].getProductId();
* itemsList[i].getProductName();
* itemsList[i].getPrice();
**/
// How can i achieve this by using one for loop, in my view we
should have two for loops one process columns and other process rows
//Correct me if im wrong
}
return sheet;
}
_____________________________________________________________________________________________
I have attached a snap shot of sheet that has to create dynamically.
Please help me how i can create the sheet in my case.
Thanks,
Vinay
On 4/11/07, Volker Weber <[EMAIL PROTECTED]> wrote:
Hi,
see this thread:
http://www.nabble.com/-Tobago--tc%3Asheet-and-c%3AforEach-tf3422077.html
Regards,
Volker
2007/4/11, Vinay Konanki <[EMAIL PROTECTED]>:
> Hi,
>
> Any one please respond to this mail.
> Any kind of help will be appreciated
>
> Thanks,
> Vinay
>
>
> On 4/9/07, Vinay Konanki < [EMAIL PROTECTED] > wrote:
> > Hi All,
> >
> > I have a link in the homepage, when i click on the link it has to
generate
> the excel sheet.
> >
> > I'm successful in generating the excel by using following example
provided
> by the group:
> >
> >
>
http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ExportUIDataToWorkbookUtil.java
> >
> > So far i have tc:sheet in the jsp where im doing binding="
> controller.table" and in controller im doing UIData = getTable();
> > This is getting the data from the tc:sheet
> > but now My question is how can i generate a UIData dynamically so that
> this controller will generate excel sheet based on that data.( because i
> dont use any table here in home page but i need to generate the excel
report
> with the list of products)
> >
> > For Example:
> > I have a list of Product Objects which consists of different values
like
> prod1.name, prod1.value , prod1.qty......
> >
> > So i need to create a table with this values.
> >
> > I hope this can be achievable, Can any help me by giving code snippet,
> > I have no idea how to generate the table dynamically in the
Controller.
> >
> > Please help me out...
> >
> > Thanks,
> > Vinay
> >
> >
> >
> >
>
>