Query regarding calendar component inside a table component

hi all,

I am using a calendar component inside a table component. The problem i am now facing is whenever i am selecting the calendar control from the first row of my table the value is repeating for all the calendar component in the corresponding other rows of the table. I want the date to be different in all the rows.

can anyone provide a solution for this

regards,

Prasant

[409 byte] By [rpk@trat] at [2007-11-26 8:27:03]
# 1

What is your calendar component bound to?

You might want to try adding a date

property to the page's Java source (the page bean) as shown below:

// replace TRIP.DEPDATE with the table name / column name

// of the data source

private java.util.Date date;

public java.util.Date getDate(){

return (java.util.Date) getValue("#{currentRow.value['TRIP.DEPDATE']}");

}

public void setDate(java.util.Date date){

setValue("#{currentRow.value['TRIP.DEPDATE']}",

new java.sql.Date(date.getTime()));

}

Then bind the calendar component's selectedDate

property to the page bean's date

property .

jetsons at 2007-7-6 21:42:14 > top of Java-index,Development Tools,Java Tools...
# 2

hi all

I am having the same problem.I have a table componenet and in that table component one calendar component.The calendar componenet is bounded to a date variable in pagebean

private java.util.Date startDate;

public java.util.Date getStartDate(){

return (java.util.Date) getValue("#{currentRow.value['start']}");

}

public void setStartDate(java.util.Date date){

setValue("#{currentRow.value['start']}",

new java.sql.Date(date.getTime()));

}

The start is the fiels in my object list data provider

here my problem is when i selects the calendar componenet in first row its working fine.if i am selecting date in second or later rows the first row changes.The selected row is not changing.can anyone help me in this? please

Thanks in advance

Sree

harisree at 2007-7-6 21:42:14 > top of Java-index,Development Tools,Java Tools...
# 3

> hi all

>

> I am having the same problem.I have a table

> componenet and in that table component one calendar

> component.The calendar componenet is bounded to a

> date variable in pagebean

Do you mean that you have bound the Calendar component's selectedDate property to the startDate page bean property?

>

> private java.util.Date startDate;

> public java.util.Date getStartDate(){

> return (java.util.Date)

> getValue("#{currentRow.value['start']}");

>}

> public void setStartDate(java.util.Date date){

> setValue("#{currentRow.value['start']}",

>

Can you explain a bit about the underlying data source the the Table component is bound to? Because the argument for currentRow.value is not in the table-name.field-name format, I am guessing that you have an array of objects and the Table component is bound to an ObjectListDataProvider? Is this correct? Also, I assume that the Array's objects have a date field? Is htis correct?

jetsons at 2007-7-6 21:42:14 > top of Java-index,Development Tools,Java Tools...
# 4

Hi,

I have similar question.. so far i have .

private java.util.Date currentDate;

public java.util.Date getCurrentDate(){

return currentDate;

}

public void setCurrentDate(java.util.Date date){

this.currentDate = currentDate;

}

the calender component bounded to the currentDate from pagebean

how does it work table and diffrent date population in each row?

a_b at 2007-7-6 21:42:14 > top of Java-index,Development Tools,Java Tools...
# 5

The date component in the table has to be bound to something that stores the date for each row. For example, when you bind a table to a database table that has a date column.

If the underlying data source does not have a date column, then you need to provide the table a place to store the individual dates for each row.

One way to do this is to create a hash table for storing the dates.

You might want to take a look at the Table component sample project at http://blogs.sun.com/roller/page/divas?entry=table_component_sample_project

Take a look at how I store the individual values for NbrServings. You can do the same with the date input.

jetsons at 2007-7-6 21:42:14 > top of Java-index,Development Tools,Java Tools...