I agree, and as I stated in the original bug report, the API could be improved.
I would not mind building the initial_value attribute as described in the bug report into the lazr-js class, but I think Björn's suggestion works too.
Björn's idea can be simplified a bit. Assuming we want the functionality across all of Launchpad, you can plug into the Picker class itself using the class-level static .plug() method.
Instead of this:
>
> var picker = new Y.Picker();
> picker.plug(TextFieldPickerPlugin('#text-field'));
>
You do this:
Y.Picker.plug(TextFieldPickerPlugin);
var picker = Y.Picker({
...
use_value_from: '#foobar' // Our new attribute
});
The class-level plugin could then add the attributes it needs dynamically.
I agree, and as I stated in the original bug report, the API could be improved.
I would not mind building the initial_value attribute as described in the bug report into the lazr-js class, but I think Björn's suggestion works too.
Björn's idea can be simplified a bit. Assuming we want the functionality across all of Launchpad, you can plug into the Picker class itself using the class-level static .plug() method.
Instead of this:
> plug(TextFieldP ickerPlugin( '#text- field') );
> var picker = new Y.Picker();
> picker.
>
You do this:
Y.Picker. plug(TextFieldP ickerPlugin) ;
var picker = Y.Picker({
...
use_value_from: '#foobar' // Our new attribute
});
The class-level plugin could then add the attributes it needs dynamically.