Thanks Alistair. Surprisingly I had tried this same thing before
sending the post but i was not able to acheive expected results. May
be something else was also missing at that time.
Thanks again,
Pradeep
On 5/25/05, Alistair McLeod <[EMAIL PROTECTED]> wrote:
> Hi Pradeep,
>
> Change your focusIn() method to the following:
>
> function focusIn() : Void {
> if ( dateObj == undefined )
> {
> createClassObject( DateField, "dateObj", 100,
> {styleName:this, owner:this});
> dateObj.width=width;
> dateObj.dateFormatter=this.formatDate;
> dateObj.addEventListener("change", this);
>
> }
> dateObj.selectedDate = dateValue;
> dateObj.visible = true;
> label.visible = false;
> dateObj.setFocus();
> }
>
> You were recreating the DateField object each time. I also removed the
> hardcoded with of 80 and set it to the cell width - this fixed the layout
> of
> the DateField when it first appeared.
>
> The creation of the DateField object probably better sits within
> createChildren, but that should make it work.
>
> Your date formatter isn't working because of scope of the dateFormat
> instance variable inside your formatDate() method, probably because you're
> adding event listeners without using the Delegate class - I'll let you work
> out the correct solution for that yourself, but a workaround for just now
> is
> to define the date formatter inside your formatDate() method:
>
> private function formatDate( date : Date ):String{
>
> var dateFormat = new DateFormatter();
> dateFormat.formatString="MM-DD-YYYY";
>
> return dateFormat.format(date);
> }
>
> Cheers,
>
> Ali
>
> --
> Alistair McLeod
> Development Director
> iteration::two
> [EMAIL PROTECTED]
>
> Office: +44 (0)131 338 6108
>
> This e-mail and any associated attachments transmitted with it may contain
> confidential information and must not be copied, or disclosed, or used by
> anyone other than the intended recipient(s). If you are not the intended
> recipient(s) please destroy this e-mail, and any copies of it, immediately.
>
> Please also note that while software systems have been used to try to
> ensure
> that this e-mail has been swept for viruses, iteration::two do not accept
> responsibility for any damage or loss caused in respect of any viruses
> transmitted by the e-mail. Please ensure your own checks are carried out
> before any attachments are opened.
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Pradeep Chaudhary
> Sent: 25 May 2005 16:02
> To: [email protected]
> Subject: [flexcoders] Custom DateCellRenderer issue.
>
> Hi,
> I'am trying to create a custom DateCellRenderer to be used in DataGrid.
> By
> default label is displayed with formatted date value. On clicking in the
> cell DateField is displayed with cell value. After changing the date the
> DateField shows empty text field and its size changes. I want it to just
> display the changed value. The DateField should disappear when user clicks
> or tabs out of the DateField with the label displaying the new value.
>
> Also i could not apply a dateFormatter function to the DateField.
>
> Can anybody please suggest what I'm missing.
>
> Attached is source code for the DateCellRenderer and sample DataGrid in
> which it is used.
>
> Thanks in advance,
> Pradeep
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
> ________________________________
> Yahoo! Groups Links
>
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/