You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by pa...@wipro.com on 2007/02/26 12:34:39 UTC

Sub columns in datatable

Hi all,
 
How to include sub columns in datatable.
It has three columns Ssn,Names,profession.
As illustrated in the fig below for Names (first names,middle names,last
names).
How to get the sub columns in the datatable.
 
Best Regards,
Pallavi



The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
 
www.wipro.com

Re: Sub columns in datatable

Posted by Werner Punz <we...@gmail.com>.
pallavi.roy@wipro.com schrieb:
> Hi all,
>  
> How to include sub columns in datatable.
> It has three columns Ssn,Names,profession.
> As illustrated in the fig below for Names (first names,middle names,last
> names).
> How to get the sub columns in the datatable.

Try to nest a datalist into the colum of your table
this should be possible.


Re: Sub columns in datatable

Posted by Amit Jain <am...@contata.co.in>.
You can do it by using datatable inside a datatable. So basically inside 
second column there will be datatable and you have to change value to 
the datatable accordingly.



pallavi.roy@wipro.com wrote:
> Hi all,
>  
> How to include sub columns in datatable.
> It has three columns Ssn,Names,profession.
> As illustrated in the fig below for Names (first names,middle 
> names,last names).
> How to get the sub columns in the datatable.
>  
> Best Regards,
> Pallavi
>
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive use of the 
> addressee(s) and may contain proprietary, confidential or privileged 
> information. If you are not the intended recipient, you should not 
> disseminate, distribute or copy this e-mail. Please notify the sender 
> immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient 
> should check this email and any attachments for the presence of 
> viruses. The company accepts no liability for any damage caused by any 
> virus transmitted by this email.
>
> www.wipro.com
>
>
> ------------------------------------------------------------------------
>

Re: [Solved] Re: Sub columns in datatable

Posted by pals <pa...@wipro.com>.
Hi Martin/Mike,

I got my mistake.
Now i am able to retrieve the values correctly from the bean.
would avoid using consecutive capital letters in attribute name.

But could you help me achieve column spans in header columns.
I have this code in my jsp if you notice the col2 header sub headers(first
Name,Middle Name,Last Name)  it does not recognize it at all.

But as you can see in the uploaded image i am getting this:



Jsp code is for col2 for header "Names":

<t:column id="col2" >
         <f:facet name="header">
             <h:outputText value="Names" />
         </f:facet>
   		 <t:column id="d1">
   		   <f:facet name="header">
   		       <h:outputText value="First Name"/>
   		    </f:facet>
	        <h:outputText value="#{subBean.firstData}" />
		  </t:column>

		  <t:column id="d2">
		    <f:facet name="header">
   		       <h:outputText value="Middle Name"/>
   		    </f:facet>
		    <h:outputText value="#{subBean.middleData}" />
		   </t:column>

		   <t:column id="d3">
		    <f:facet name="header">
   		       <h:outputText value="Last Name"/>
   		     </f:facet>
			  <h:outputText value="#{subBean.lastData}" />
		   </t:column>
		   
	     </t:column>
   

Best Regards,
Pallavi 







Martin Marinschek wrote:
> 
> myBean.setFName() and myBean.getFName() in the source
> 
> would mean:
> 
> #{myBean.FName}
> 
> in the JSP
> 
> regards,
> 
> Martin
> 
> On 2/28/07, Mike Kienenberger <mk...@gmail.com> wrote:
>>
>> Two possibilities that I know of:
>>
>> 1 - you didn't provide the correct getter accessor. (public, correct
>> type,
>> etc)
>> 2 - you didn't name the getter correctly.   This is probably the issue
>> since your code below has "FName" but your error message has "fName".  
>> I'd
>> recommend avoiding names starting with consecutive capital letters unless
>> you have a good understanding of bean property naming conventions.
>>
>> On 2/28/07, pallavi.roy@wipro.com <pa...@wipro.com> wrote:
>> >
>> >  Hi All,
>> >
>> > I am getting this exception when i try nesting my dataTable:
>> > I am unable to read Names from the bean.
>> > Could you let me know why i am getting this exception.
>> > How can i include sub headers in my nested datatable.
>> >
>> > *javax.faces.el.PropertyNotFoundException*
>> > : Error getting property 'fName' from bean of type rich.poor.NamesVO
>> > This is my data  model:
>> >
>> > public class SubDataBean {
>> >
>> > int ssn;
>> > String profession;
>> > List myNames;
>> >
>> > }
>> >
>> > public class NamesVO {
>> >
>> >  String fName;
>> >  String mName;
>> >  String lName;
>> >  }
>> > In my manage bean i am populationg the datalist in the following
>> manner:
>> >
>> > public void populateData(){
>> >
>> >    SubDataBean b1 = new SubDataBean();
>> >    NamesVO t1 = new NamesVO();
>> >    List x1 = new ArrayList();
>> >    b1.setSsn(10);
>> >    t1.setFName("Pabitra");
>> >    t1.setMName("Kumar");
>> >    t1.setLName("Roy");
>> >    x1.add(t1);
>> >    b1.setMyNames(x1);
>> >    b1.setProfession("Mechanical Engineer");
>> >
>> >    dataList.add(b1);
>> >
>> > }
>> >
>> >  <t:column id="col2">
>> > <f:facet name="header">
>> > <h:outputText value="Names" />
>> > </f:facet>
>> >
>> > <t:dataTable id="insideCol" value="#{subBean.myNames}"
>> > var="demoBean" rows="2" cellspacing="0" styleClass="dataTable"
>> > columnClasses="firstColumn,secondColumn,thirdColumn">
>> >
>> >
>> > <t:column id="c1">
>> > <h:outputText value="#{demoBean.fName}" />
>> > </t:column>
>> > ........
>> >
>> >
>> > Best Regards,
>> >
>> > Pallavi
>> >  ------------------------------
>> > *From:* Werner Punz [mailto:werner.punz@gmail.com]
>> > *Sent:* Tuesday, February 27, 2007 5:48 PM
>> > *To:* Pallavi Roy(WT01 - HLS)
>> > *Subject:* Re: Re: Sub columns in datatable
>> >
>> >    <t:dataTable id="insideCol" value="#{subBean .dataList}"
>> >        var="demoBean" rows="2" rowClasses="row,row_alt"
>> >       cellspacing="0" styleClass="dataTable" headerClass="headerClass">
>> >
>> > otherwise you will not have a reference to the current row...
>> >
>> > On 2/27/07, pallavi.roy@wipro.com < pallavi.roy@wipro.com> wrote:
>> > >
>> > >  Hi Werner,
>> > >
>> > > I have implemented in the follwoing way but my page is not getting
>> > > rendered.
>> > > I have nested another dataTable in the second column.
>> > > Could you let me know my mistake.
>> > >
>> > > <f:view>
>> > >  <h:form id="mySub">
>> > >  <t:dataTable id="subColumn" value="#{my_SubManageBean.dataList}"
>> > >      var="subBean" rows="2" rowClasses="row,row_alt" width="100%"
>> > >       cellspacing="0" styleClass="dataTable"
>> > > headerClass="headerClass">
>> > >
>> > >   <t:column id="col1">
>> > >     <f:facet name="header">
>> > >        <h:outputText value="SSN" />
>> > >     </f:facet>
>> > >        <h:outputText value="#{subBean.ssn}" />
>> > >    </t:column>
>> > >
>> > >    <t:column id="col2">
>> > >     <f:facet name="header">
>> > >        <h:outputText value="Names" />
>> > >     </f:facet>
>> > >       <t:dataTable id="insideCol"
>> value="#{my_SubManageBean.dataList}"
>> > >        var="demoBean" rows="2" rowClasses="row,row_alt"
>> > >       cellspacing="0" styleClass="dataTable"
>> > > headerClass="headerClass">
>> > >
>> > >       <t:column id="c1">
>> > >       <f:facet name="header">
>> > >        <h:outputText value="First Name" />
>> > >       </f:facet>
>> > >        <h:outputText value="#{demoBean.fName}" />
>> > >       </t:column>
>> > >
>> > >       <t:column id="c2">
>> > >       <f:facet name="header">
>> > >        <h:outputText value="Middle Name" />
>> > >       </f:facet>
>> > >        <h:outputText value="#{demoBean.mName}" />
>> > >       </t:column>
>> > >
>> > >       <t:column id="c3">
>> > >       <f:facet name="header">
>> > >        <h:outputText value="Last Name" />
>> > >       </f:facet>
>> > >        <h:outputText value="#{demoBean.lName}" />
>> > >       </t:column>
>> > >       </t:dataTable>
>> > >
>> > >    </t:column>
>> > >
>> > >    <t:column id="col3">
>> > >     <f:facet name="header">
>> > >        <h:outputText value="Profession" />
>> > >     </f:facet>
>> > >        <h:outputText value="#{subBean.profession}" />
>> > >    </t:column>
>> > >
>> > >   </t:dataTable>
>> > >  </h:form>
>> > > </f:view>
>> > >
>> > > Best Regards,
>> > > Pallavi
>> > >
>> > >  ------------------------------
>> > > *From:* Werner Punz [mailto:werner.punz@gmail.com]
>> > > *Sent:* Tuesday, February 27, 2007 4:06 PM
>> > > *To:* Pallavi Roy(WT01 - HLS)
>> > > *Subject:* Re: Re: Sub columns in datatable
>> > >
>> > >  not yet since i am not at home, but here is how you do it
>> > > in a datatable you have a var which you use to display your data in
>> > > the table columns
>> > > oc
>> > > you just have to push this var into a nested column datalist or
>> > > datatable
>> > > and process it like you would a standalone table
>> > >
>> > >
>> > > On 2/27/07, pallavi.roy@wipro.com < pallavi.roy@wipro.com> wrote:
>> > > >
>> > > >
>> > > > Hi Werner,
>> > > >
>> > > > Do you have any code snippet as to how can I add my sub headers
>> > > > using
>> > > > dataList to t:dataTable.
>> > > > How would the data model be affected....
>> > > >
>> > > > Class SubDataBean{
>> > > >
>> > > > int ssn;
>> > > > String fName;
>> > > > String mName;
>> > > > String lName;
>> > > > String profession;
>> > > > }
>> > > >
>> > > > Best Regards,
>> > > > Pallavi
>> > > >
>> > > > -----Original Message-----
>> > > > From: news [mailto:news@sea.gmane.org] On Behalf Of Werner Punz
>> > > > Sent: Monday, February 26, 2007 6:04 PM
>> > > > To: users@myfaces.apache.org
>> > > > Subject: Re: Sub columns in datatable
>> > > >
>> > > > pallavi.roy@wipro.com schrieb:
>> > > > > Hi all,
>> > > > >
>> > > > > How to include sub columns in datatable.
>> > > > > It has three columns Ssn,Names,profession.
>> > > > > As illustrated in the fig below for Names (first names,middle
>> > > > > names,last names).
>> > > > > How to get the sub columns in the datatable.
>> > > >
>> > > > Try to nest a datalist into the colum of your table this should be
>> > > > possible.
>> > > >
>> > > >
>> > > > The information contained in this electronic message and any
>> > > > attachments to this message are intended for the exclusive use of
>> the
>> > > > addressee(s) and may contain proprietary, confidential or
>> privileged
>> > > > information. If you are not the intended recipient, you should not
>> > > > disseminate, distribute or copy this e-mail. Please notify the
>> sender
>> > > > immediately and destroy all copies of this message and any
>> attachments.
>> > > > WARNING: Computer viruses can be transmitted via email. The
>> recipient should
>> > > > check this email and any attachments for the presence of viruses.
>> The
>> > > > company accepts no liability for any damage caused by any virus
>> transmitted
>> > > > by this email.   www.wipro.com
>> > > >
>> > >
>> > >    The information contained in this electronic message and any
>> > > attachments to this message are intended for the exclusive use of the
>> > > addressee(s) and may contain proprietary, confidential or privileged
>> > > information. If you are not the intended recipient, you should not
>> > > disseminate, distribute or copy this e-mail. Please notify the sender
>> > > immediately and destroy all copies of this message and any
>> attachments.
>> > > WARNING: Computer viruses can be transmitted via email. The recipient
>> should
>> > > check this email and any attachments for the presence of viruses. The
>> > > company accepts no liability for any damage caused by any virus
>> transmitted
>> > > by this email. www.wipro.com
>> > >
>> >
>> >
>> > The information contained in this electronic message and any
>> attachments
>> > to this message are intended for the exclusive use of the addressee(s)
>> and
>> > may contain proprietary, confidential or privileged information. If you
>> are
>> > not the intended recipient, you should not disseminate, distribute or
>> copy
>> > this e-mail. Please notify the sender immediately and destroy all
>> copies of
>> > this message and any attachments.
>> >
>> > WARNING: Computer viruses can be transmitted via email. The recipient
>> > should check this email and any attachments for the presence of
>> viruses. The
>> > company accepts no liability for any damage caused by any virus
>> transmitted
>> > by this email.
>> >
>> > www.wipro.com
>> >
>>
>>
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 
http://www.nabble.com/file/7009/sub%20column.bmp 
-- 
View this message in context: http://www.nabble.com/Sub-columns-in-datatable-tf3292321.html#a9347815
Sent from the MyFaces - Users mailing list archive at Nabble.com.