Yii Framework Forum: Datepicker control (Extending/modifying CHtml helper) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Datepicker control (Extending/modifying CHtml helper) Rate Topic: -----

#1 User is offline   KJedi 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 381
  • Joined: 19-October 08
  • Location:Nikolaev, Ukraine (Europe)

Posted 01 December 2008 - 08:40 AM

How to extend/add method to CHtml to get date picker control using jQuery's datepicker?
If better way is extending, them where to place file, how to import it and where to use this helper?

Where to put jQuery's UI library? Is it already present somewhere in Yii? Is core jQuery library already included?
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 01 December 2008 - 10:10 AM

Do not extend CHtml because it is a static class and not very convenient to add complex logic like date picker needs.

Instead, write a new widget. You may refer to CTreeView or other similar widgets and see how to do so.

jQuery core library is in Yii, but not jQuery UI. Again, refer to CTreeView and see how to include a js library.
0

#3 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 01 December 2008 - 10:11 AM

You don't need to extend CHtml, you need to create a Widget, by extending CInputWidget.
0

#4 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 01 December 2008 - 12:38 PM

Quote

jQuery core library is in Yii, but not jQuery UI. Again, refer to CTreeView and see how to include a js library.


I think it should be helpful to have the jQuery UI included in Yii, so we can avoid possible conflicts in the case several extensions use that library. If the developers know that jQuery is included in Yii, they would use this instead of including it on their extensions.
0

#5 User is offline   KJedi 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 381
  • Joined: 19-October 08
  • Location:Nikolaev, Ukraine (Europe)

Posted 02 December 2008 - 04:50 AM

Where should I put my widgets? Extensions dir? or where?
0

#6 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 02 December 2008 - 07:44 AM

MetaYii: We won't include jQuery UI in the core in 1.0. We still need more time to fully evaluate it.

Konstantin: you can place widgets anywhere, as long as you can refer to it when using it. My personal preference is to put it under protected/components. The directory protected/extensions is used to store extensions you download from third party.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users