PDA

View Full Version : TriggerField + NumberField



mattsmith321
9 Apr 2007, 11:54 AM
Is it possible to create a new field that subclasses TriggerField and NumberField? If so, what are the basics to get me started? I've tried a couple of things, nothing has worked so far.

I have the need for an input field that has numeric constraints (like NumberField) and has the ability to initiate an action (like TriggerField). I know I could just start with NumberField and put in my own custom actions, but I like how the TriggerField blends in and would look very similar to the DateField functionality.

I ran across ChooserField: A TriggerField extension example (http://extjs.com/forum/showthread.php?t=3613&highlight=triggerfield), which is a great template to get me started subclassing the TriggerField but I'm not quite sure how to combine the two into one control.

Thanks!

jack.slocum
9 Apr 2007, 12:00 PM
Because the 2 follow two different branches there is no easy way to do it with inheritance. At this point all I can suggest is cut n paste of the TriggerField code into a subclass of NumberField since it is the shorter of the 2. I'm sure that is not the answer you were looking for though. :(

mattsmith321
9 Apr 2007, 12:03 PM
Because the 2 follow two different branches there is no easy way to do it with inheritance. At this point all I can suggest is cut n paste of the TriggerField code into a subclass of NumberField since it is the shorter of the 2. I'm sure that is not the answer you were looking for though. :(

Thanks. It's not what I was hoping for, but it is what I was expecting. I just needed confirmation that there wasn't an easier way to do it.