You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by sandipp <sa...@yahoo.com> on 2007/06/05 13:48:01 UTC

designing h:dataTable

Hi All,

I want to design datatTable as,

-----------------------------------------------------------------------------------
Edit |               Personal Information        | Account Information |                                  
// first row
-----------------------------------------------------------------------------------
edit | first name | middle name |last name | bank name | a/c no |                                   
// second row
-----------------------------------------------------------------------------------

I am able to get second row by follwoing code as.

<h:dataTable width="100%" border="0" headerClass="firstRow"
rowClasses="row1,row2" value="SomeValue">
<h:column>
<f:facet name="header">
<h:outputText id="editHeader" value="edit" />
</f:facet>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText id="editHeader" value="first name" />
</f:facet>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText id="editHeader" value="middle name" />
</f:facet>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText id="editHeader" value="last name" />
</f:facet>
</h:column> 
<h:column>
<f:facet name="header">
<h:outputText id="editHeader" value="bank name" />
</f:facet>
</h:column> 
<h:column>
<f:facet name="header">
<h:outputText id="editHeader" value="a/c no" />
</f:facet>
</h:column>
</h:dataTable>

But I am not able to set first row.
i.e. I want Edit from first row will fit for edit for second row
lly, Personal Information will fit for first name,middle name,last name
and Account Information will fit for bank name a/c no

Can anybody tell me how to do this ?

Thanks
Sandip

-- 
View this message in context: http://www.nabble.com/designing-h%3AdataTable-tf3871240.html#a10967828
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: h:dataTable Beginner's question

Posted by Cagatay Civici <ca...@gmail.com>.
Hi,

Tomahawk's selectItems may help.

<h:selectOneMenu styleClass="blue" value="currentVersion">
 <t:selectItems value="#{rowObject.items}" var="item" itemLabel="#{
item.label}" itemValue="#{item.value}"/>
</h:selectOneMenu>

Regards,

Cagatay

On 8/6/07, David Delbecq <de...@oma.be> wrote:
>
> First alternative, using component binding (note: your backedbean must
> be session scoped):
> <h:dataTable binding="#{backedBean.component} value="..."  ... >
>
>     ....
>        <h:selectOneMenu styleClass="blue" value="currentVersion">
>             <f:selectItems value="#{backedBean.version}"/>
>        </h:selectOneMenu>
>     ....
> </h:dataTable>
>
> In you backed bean:
>
> public void setComponent(UIComponent component) {...}
> public UIComponent getComponent() {...}
> public SelectItem[] getVersion() {
>     ...
>     int row = ((UIData)getComponent()).getRowIndex();
>     ...
> }
>
> Second alternative (prefered), do a separate selectItems construction in
> each bean of collection:
> <h:dataTable value="#{backedBean.items}" var="item" >
>
>     ....
>        <h:selectOneMenu styleClass="blue" value="#{item.currentVersion}">
>             <f:selectItems value="#{item.availableVersions}"/>
>        </h:selectOneMenu>
>     ....
> </h:dataTable>
> En l'instant précis du 06/08/07 10:07, Dipl.-Ing. Torsten Liermann
> s'exprimait en ces termes:
> > Hi,
> >
> > A Beginner's question to h:dataTable
> >
> > I have a table for each row another
> > Combo box must be generated. The contents surrender from the current row
> object
> >
> > Unfortunately, the expression Language does not support the following
> syntax:
> >
> > <h:selectOneMenu styleClass="blue" value="currentVersion">
> >   <f:selectItems value="#{backedBean.version(rowObject}"/>
> > </h:selectOneMenu>
> >
> >
> > Is there a callback into the backing bean which is called for each row?
> > Or how is the recommended way without touch the domain object?
> >
> > Thanks
> > Torsten
> >
>
>
> --
> http://www.noooxml.org/
>
>

Re: h:dataTable Beginner's question

Posted by David Delbecq <de...@oma.be>.
First alternative, using component binding (note: your backedbean must
be session scoped):
<h:dataTable binding="#{backedBean.component} value="..."  ... >

    ....
       <h:selectOneMenu styleClass="blue" value="currentVersion">
            <f:selectItems value="#{backedBean.version}"/>
       </h:selectOneMenu> 
    ....
</h:dataTable>

In you backed bean:

public void setComponent(UIComponent component) {...}
public UIComponent getComponent() {...}
public SelectItem[] getVersion() {
    ...
    int row = ((UIData)getComponent()).getRowIndex();
    ...
}

Second alternative (prefered), do a separate selectItems construction in
each bean of collection:
<h:dataTable value="#{backedBean.items}" var="item" >

    ....
       <h:selectOneMenu styleClass="blue" value="#{item.currentVersion}">
            <f:selectItems value="#{item.availableVersions}"/>
       </h:selectOneMenu> 
    ....
</h:dataTable>
En l'instant précis du 06/08/07 10:07, Dipl.-Ing. Torsten Liermann
s'exprimait en ces termes:
> Hi,
>
> A Beginner's question to h:dataTable
>
> I have a table for each row another
> Combo box must be generated. The contents surrender from the current row object
>
> Unfortunately, the expression Language does not support the following syntax:
>
> <h:selectOneMenu styleClass="blue" value="currentVersion">
>   <f:selectItems value="#{backedBean.version(rowObject}"/>
> </h:selectOneMenu>
>
>
> Is there a callback into the backing bean which is called for each row?
> Or how is the recommended way without touch the domain object?
>
> Thanks
> Torsten
>   


-- 
http://www.noooxml.org/


h:dataTable Beginner's question

Posted by "Dipl.-Ing. Torsten Liermann" <li...@liermann-it.de>.
Hi,

A Beginner's question to h:dataTable

I have a table for each row another
Combo box must be generated. The contents surrender from the current row object

Unfortunately, the expression Language does not support the following syntax:

<h:selectOneMenu styleClass="blue" value="currentVersion">
  <f:selectItems value="#{backedBean.version(rowObject}"/>
</h:selectOneMenu>


Is there a callback into the backing bean which is called for each row?
Or how is the recommended way without touch the domain object?

Thanks
Torsten

Re: designing h:dataTable

Posted by vgarmash <gl...@tut.by>.
You can use solution from here: 
http://jsf.javabeat.net/articles/2007/06/java-server-faces-jsf-html-tag-library/ 
http://jsf.javabeat.net/articles/2007/06/java-server-faces-jsf-html-tag-library/ 
or from here: http://www.exadel.com/tutorial/jsf/jsftags-guide.html
http://www.exadel.com/tutorial/jsf/jsftags-guide.html 

It partially resolve problem with colspan in the header. But you can span
only one header for one table. I don't know how to do it for one table and I
used panelgrid with several datatable in it for every grouped columns. Now
my code looks like this:

<h:panelGrid columns="2" cellpadding="0" cellspacing="0" border="1">
				<h:dataTable value="#{listForTable}" var="item"
captionClass="bids-header" cellpadding="0" cellspacing="0" border="1">
					<f:facet name="header">
						<h:outputText value="Bid"/>
					</f:facet>					
					<h:column>
						<f:facet name="header">
							<h:outputText value="Line #"/>
						</f:facet>
						<h:outputText value="#{item.field1}"/>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="Item #"/>
						</f:facet>
						<h:outputText value="#{item.field2}"/>
					</h:column>						
				</h:dataTable>
				<h:dataTable value="#{listForTable}" var="item"
captionClass="bids-header" cellpadding="0" cellspacing="0" border="1">
						<f:facet name="header">
							<h:outputText value="GFS"/>
						</f:facet>					
						<h:column>
							<f:facet name="header">
								<h:outputText value="Line #"/>
							</f:facet>
							<h:outputText value="#{item.field1}"/>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Item #"/>
							</f:facet>
							<h:outputText value="#{item.field2}"/>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Line #"/>
							</f:facet>
							<h:outputText value="#{item.field1}"/>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Item #"/>
							</f:facet>
							<h:outputText value="#{item.field2}"/>
						</h:column>					
				</h:dataTable>
				</h:panelGrid>


sandipp wrote:
> 
> Hi Thanks All,
> 
> Actually I do not want to change my h:dataTable now.
> 
> I want to keep h:dataTable(which displaying second row header).
> So is it possible with normal html table.Since I tried with it but its not
> accepting colspan for normal html.
> Any code sample will be great help for me.
> 
> Thanks
> Sandip
> 
> 
> 
> Ryan Wynn-2 wrote:
>> 
>> t:dataList allows you more fine grained control over the display.
>> 
>> On 6/5/07, ncheltsov <nc...@obs.bg> wrote:
>>> I am not sure, that I fully understand your question, but I think, that
>>> h:dataTable element is not intended
>>> for such use. You can display with it some tabular information, set
>>> header and footer and apply some visual cosmetic.
>>> That's all. Consider using other  component.
>>>
>>> P.S. Of course  I can be wrong. I will be glad someone to correct me :)
>>>
>>> sandipp wrote:
>>> > Hi All,
>>> >
>>> > I want to design datatTable as,
>>> >
>>> >
>>> -----------------------------------------------------------------------------------
>>> > Edit |               Personal Information        | Account Information
>>> |
>>> >
>>> -----------------------------------------------------------------------------------
>>> > edit | first name | middle name |last name | bank name | a/c no |
>>> >
>>> -----------------------------------------------------------------------------------
>>> >
>>> > I am able to get second row by follwoing code as.
>>> >
>>> > <h:dataTable width="100%" border="0" headerClass="firstRow"
>>> > rowClasses="row1,row2" value="SomeValue">
>>> > <h:column>
>>> > <f:facet name="header">
>>> > <h:outputText id="editHeader" value="edit" />
>>> > </f:facet>
>>> > </h:column>
>>> > <h:column>
>>> > <f:facet name="header">
>>> > <h:outputText id="editHeader" value="first name" />
>>> > </f:facet>
>>> > </h:column>
>>> > <h:column>
>>> > <f:facet name="header">
>>> > <h:outputText id="editHeader" value="middle name" />
>>> > </f:facet>
>>> > </h:column>
>>> > <h:column>
>>> > <f:facet name="header">
>>> > <h:outputText id="editHeader" value="last name" />
>>> > </f:facet>
>>> > </h:column>
>>> > <h:column>
>>> > <f:facet name="header">
>>> > <h:outputText id="editHeader" value="bank name" />
>>> > </f:facet>
>>> > </h:column>
>>> > <h:column>
>>> > <f:facet name="header">
>>> > <h:outputText id="editHeader" value="a/c no" />
>>> > </f:facet>
>>> > </h:column>
>>> > </h:dataTable>
>>> >
>>> > But I am not able to set first row.
>>> > i.e. I want Edit from first row will fit for edit for second row
>>> > lly, Personal Information will fit for first name,middle name,last
>>> name
>>> > and Account Information will fit for bank name a/c no
>>> >
>>> > Can anybody tell me how to do this ?
>>> >
>>> > Thanks
>>> > Sandip
>>> >
>>> >
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/designing-h%3AdataTable-tf3871240.html#a12000741
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: designing h:dataTable

Posted by sandipp <sa...@yahoo.com>.
Hi Thanks All,

Actually I do not want to change my h:dataTable now.

I want to keep h:dataTable(which displaying second row header).
So is it possible with normal html table.Since I tried with it but its not
accepting colspan for normal html.
Any code sample will be great help for me.

Thanks
Sandip



Ryan Wynn-2 wrote:
> 
> t:dataList allows you more fine grained control over the display.
> 
> On 6/5/07, ncheltsov <nc...@obs.bg> wrote:
>> I am not sure, that I fully understand your question, but I think, that
>> h:dataTable element is not intended
>> for such use. You can display with it some tabular information, set
>> header and footer and apply some visual cosmetic.
>> That's all. Consider using other  component.
>>
>> P.S. Of course  I can be wrong. I will be glad someone to correct me :)
>>
>> sandipp wrote:
>> > Hi All,
>> >
>> > I want to design datatTable as,
>> >
>> >
>> -----------------------------------------------------------------------------------
>> > Edit |               Personal Information        | Account Information
>> |
>> >
>> -----------------------------------------------------------------------------------
>> > edit | first name | middle name |last name | bank name | a/c no |
>> >
>> -----------------------------------------------------------------------------------
>> >
>> > I am able to get second row by follwoing code as.
>> >
>> > <h:dataTable width="100%" border="0" headerClass="firstRow"
>> > rowClasses="row1,row2" value="SomeValue">
>> > <h:column>
>> > <f:facet name="header">
>> > <h:outputText id="editHeader" value="edit" />
>> > </f:facet>
>> > </h:column>
>> > <h:column>
>> > <f:facet name="header">
>> > <h:outputText id="editHeader" value="first name" />
>> > </f:facet>
>> > </h:column>
>> > <h:column>
>> > <f:facet name="header">
>> > <h:outputText id="editHeader" value="middle name" />
>> > </f:facet>
>> > </h:column>
>> > <h:column>
>> > <f:facet name="header">
>> > <h:outputText id="editHeader" value="last name" />
>> > </f:facet>
>> > </h:column>
>> > <h:column>
>> > <f:facet name="header">
>> > <h:outputText id="editHeader" value="bank name" />
>> > </f:facet>
>> > </h:column>
>> > <h:column>
>> > <f:facet name="header">
>> > <h:outputText id="editHeader" value="a/c no" />
>> > </f:facet>
>> > </h:column>
>> > </h:dataTable>
>> >
>> > But I am not able to set first row.
>> > i.e. I want Edit from first row will fit for edit for second row
>> > lly, Personal Information will fit for first name,middle name,last name
>> > and Account Information will fit for bank name a/c no
>> >
>> > Can anybody tell me how to do this ?
>> >
>> > Thanks
>> > Sandip
>> >
>> >
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/designing-h%3AdataTable-tf3871240.html#a10981867
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: designing h:dataTable

Posted by Ryan Wynn <bi...@gmail.com>.
t:dataList allows you more fine grained control over the display.

On 6/5/07, ncheltsov <nc...@obs.bg> wrote:
> I am not sure, that I fully understand your question, but I think, that
> h:dataTable element is not intended
> for such use. You can display with it some tabular information, set
> header and footer and apply some visual cosmetic.
> That's all. Consider using other  component.
>
> P.S. Of course  I can be wrong. I will be glad someone to correct me :)
>
> sandipp wrote:
> > Hi All,
> >
> > I want to design datatTable as,
> >
> > -----------------------------------------------------------------------------------
> > Edit |               Personal Information        | Account Information |
> > -----------------------------------------------------------------------------------
> > edit | first name | middle name |last name | bank name | a/c no |
> > -----------------------------------------------------------------------------------
> >
> > I am able to get second row by follwoing code as.
> >
> > <h:dataTable width="100%" border="0" headerClass="firstRow"
> > rowClasses="row1,row2" value="SomeValue">
> > <h:column>
> > <f:facet name="header">
> > <h:outputText id="editHeader" value="edit" />
> > </f:facet>
> > </h:column>
> > <h:column>
> > <f:facet name="header">
> > <h:outputText id="editHeader" value="first name" />
> > </f:facet>
> > </h:column>
> > <h:column>
> > <f:facet name="header">
> > <h:outputText id="editHeader" value="middle name" />
> > </f:facet>
> > </h:column>
> > <h:column>
> > <f:facet name="header">
> > <h:outputText id="editHeader" value="last name" />
> > </f:facet>
> > </h:column>
> > <h:column>
> > <f:facet name="header">
> > <h:outputText id="editHeader" value="bank name" />
> > </f:facet>
> > </h:column>
> > <h:column>
> > <f:facet name="header">
> > <h:outputText id="editHeader" value="a/c no" />
> > </f:facet>
> > </h:column>
> > </h:dataTable>
> >
> > But I am not able to set first row.
> > i.e. I want Edit from first row will fit for edit for second row
> > lly, Personal Information will fit for first name,middle name,last name
> > and Account Information will fit for bank name a/c no
> >
> > Can anybody tell me how to do this ?
> >
> > Thanks
> > Sandip
> >
> >
>
>

Re: designing h:dataTable

Posted by ncheltsov <nc...@obs.bg>.
I am not sure, that I fully understand your question, but I think, that 
h:dataTable element is not intended
for such use. You can display with it some tabular information, set 
header and footer and apply some visual cosmetic.
That's all. Consider using other  component.

P.S. Of course  I can be wrong. I will be glad someone to correct me :)

sandipp wrote:
> Hi All,
>
> I want to design datatTable as,
>
> -----------------------------------------------------------------------------------
> Edit |               Personal Information        | Account Information |                                   
> -----------------------------------------------------------------------------------
> edit | first name | middle name |last name | bank name | a/c no |                                    
> -----------------------------------------------------------------------------------
>
> I am able to get second row by follwoing code as.
>
> <h:dataTable width="100%" border="0" headerClass="firstRow"
> rowClasses="row1,row2" value="SomeValue">
> <h:column>
> <f:facet name="header">
> <h:outputText id="editHeader" value="edit" />
> </f:facet>
> </h:column>
> <h:column>
> <f:facet name="header">
> <h:outputText id="editHeader" value="first name" />
> </f:facet>
> </h:column>
> <h:column>
> <f:facet name="header">
> <h:outputText id="editHeader" value="middle name" />
> </f:facet>
> </h:column>
> <h:column>
> <f:facet name="header">
> <h:outputText id="editHeader" value="last name" />
> </f:facet>
> </h:column> 
> <h:column>
> <f:facet name="header">
> <h:outputText id="editHeader" value="bank name" />
> </f:facet>
> </h:column> 
> <h:column>
> <f:facet name="header">
> <h:outputText id="editHeader" value="a/c no" />
> </f:facet>
> </h:column>
> </h:dataTable>
>
> But I am not able to set first row.
> i.e. I want Edit from first row will fit for edit for second row
> lly, Personal Information will fit for first name,middle name,last name
> and Account Information will fit for bank name a/c no
>
> Can anybody tell me how to do this ?
>
> Thanks
> Sandip
>
>