PDA

View Full Version : How to cast ExtJS Objects ?



DarkStarDS
14 Sep 2009, 5:01 AM
Hello, I have this component: Ext.getCmp('fromDateItem')
This component is a DateField, but with the getCmp() function I get an object. So the DateField functions are not recognized and I need to cast this object into a DateField component. How do I do this ?
I precise that there is no other way to get this component (no reference, the object is created for each tabs of my application).

Thank you ! ;)

evant
14 Sep 2009, 5:05 AM
There is no casting. If the DateField functions aren't available, it means getCmp didn't return a DateField object.

DarkStarDS
14 Sep 2009, 5:48 AM
Yes, you are right. Another precision: when a datefield hasn't been validated, the value (datefield.getValue()) is empty (== ""). So I guess this is why the string functions I try to apply on the value weren't recognized.
Thanks.