flex - Extending DropDownList to include an extra option -


I want to expand the DropDownList control to include an option to create and edit options. for example; For the list of projects in the dropdown list, there will be another option "Create new project ..." or "Edit project ..." and it will be the last option in the list. When the user selects this option, there will be no change in the selected index or selected item and the related action will be taken (for example a popup window appears). This will be a convenient way for the end user.

Now I want to work independently from context and the square should be reusable. The user will only specify optionText and optionFunction to work this option. The basic structure of the square looks like this:

  Public category OptiveDropDownList accesses DropDownList {Private var _enableOption: Boolean; Private var _optionText: string; Private var _originalDataProvider: IList; [Bindable] public variable options function: function; Public Function OptiveDropDownList () {super (); } Public function set option text (value: string): zero {_optionText = value; DataProvider = _originalDataProvider; } Enable Public Function Set Option (Value: Boolean): Zero {_enableOption = value; DataProvider = _originalDataProvider; } Set the public override function Dataprover (Value: ILIIT): Zero {_originalDataProvider = value; Var DP: IELIT = Faucet; If (! Value) {dp = new ArrayCollection (value.toArray ()); If (_enableOption) {var op: object = new object (); Select [labelField] = _ optionText; Dp.addItem (optional); }} Super.dataProvider = DP; } [Bindabile] Public override function gets the Dataprador (): IILIT {return_OriyDialdataDownloader; }}   

I hope my code is clear to understand, I'm adding an additional object to the installer for the option. The names of the fields are self explanatory.

I need to select and capture the call option, preventing the default work from preventing the pointer from a faulty error.

In advance thank you

Just add an event listener to the original datataprator. All implementations of iList should be sent to CollectionEvent.COLLECTION_CHANGE , when there will be a change in the list (such as Add, Remove or change an existing object in the list). In your event handler, you can update dropdownlist's datatypad accordingly. By override

mx_internal method setSelectedIndex () , you can adjust the selection according to your wishes. Take a look at the blog post for some inspiration.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -