Hi there! I don't know prcicely what you are planing to do with your
class but I've written a chass that links select elements to each
other. Maybe this will save you a lot of time or perhaps this is good
for your learning curve.

Check it out on http://youngdutchdesign.com/cvlinkselect-class-v1-3-released

On Feb 27, 1:15 am, "Matthew Hazlett" <[email protected]> wrote:
> ohh, thanks for the link, some good info!
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of nwhite
> Sent: Friday, February 26, 2010 6:34 PM
> To: [email protected]
> Subject: Re: [Moo] Removing items from a select box
>
> http://www.propertymaps.com/blog/2008/04/10/dynamically-populating-se...
> ements-with-javascript/
>
> Explains the issues in greater detail
>
> On Fri, Feb 26, 2010 at 5:15 PM, Matthew Hazlett <[email protected]> wrote:
>
> Sry that was my bad I forgot to create the class :-) Your way does work
> outside of a class, but I need it to work inside a class structure.
>
> I updated and broke your example by adding in a class structure.
>
> new Class(
>
> {
>
>     initialize: function()
>
>     {
>
>                 new Element('option',
>
>                 {
>
>                                 text: 'the text',
>
>                                 value: 0}
>
>                 ).inject('test');    
>
>                                 new Element('option',
>
>                                 {
>
>                                                 text: 'the selected text',
>
>                                                 value: 0, selected: true
>
>                                 }).inject('test');
>
>                                 new Element('option',
>
>                                 {
>
>                                                 text: 'another text',
>
>                                                 value: 0
>
>                                 }).inject('test');
>
>     }
>
> })();
>
> I am working with select items more (in pure js) then I ever have for this
> project and fining all sorts of isssues.  The latest one I found is on
> Google Chrome (may effect other webkit browsers).  If you dynamically
> populate a select then do element.getSelected() immediately, Google Chrome
> reports nothing, while FF and IE have no trouble returning the first item in
> the options array.  I can get around these issues but it really cramping my
> development flow, maybe I should just finish the app with asp.net and do the
> logic on the server.
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Thierry bela nanga
> Sent: Friday, February 26, 2010 4:24 PM
>
> To: [email protected]
> Subject: Re: [Moo] Removing items from a select box
>
> your example fixed
>
> http://mootools.net/shell/aAJWE/3/
>
> http://mootools.net/shell/qxZHE/2/
>
> 2010/2/26 Fábio M. Costa <[email protected]>
>
> it looks like mooshell is throwing some errors :S
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interfaces
>
> On Fri, Feb 26, 2010 at 5:37 PM, Matthew Hazlett <[email protected]> wrote:
>
> Yes, it fails with the moo error of:
>
> setting a property that has only a 
> getterhttp://mootools.net/shell/js/lib/mootools-1.2.4-core-nc.js      Line 
> 1180
>
> Your way:
>
> http://mootools.net/shell/Dcm48/
>
> This also fails, but should work:
>
> http://mootools.net/shell/aAJWE/2/
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Fábio M. Costa
> Sent: Friday, February 26, 2010 12:39 PM
>
> To: [email protected]
> Subject: Re: [Moo] Removing items from a select box
>
> $('ddArtists').adopt(new Element('option', {'html': itm.Text, 'value':
> item.Value});
>
> doesnt work?
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interfaces
>
> On Fri, Feb 26, 2010 at 2:06 PM, Thierry bela nanga <[email protected]>
> wrote:
>
> this works in IE
>
> http://mootools.net/shell/qxZHE/
>
> On Fri, Feb 26, 2010 at 5:53 PM, Matthew Hazlett <[email protected]> wrote:
>
> Thanks!
>
> But this dosn't work in IE:
>
> $('ddArtists').adopt(new Option(itm.Text, itm.Value));
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Thierry bela nanga
> Sent: Friday, February 26, 2010 11:42 AM
> To: [email protected]
> Subject: Re: [Moo] Removing items from a select box
>
> select.empty(); //remove all options
>
> select.adopt(new Option(itm.Text, itm.Value)) //add an option
>
> On Fri, Feb 26, 2010 at 5:33 PM, hazlema <[email protected]> wrote:
>
> Is there a mooish way to remove all items from a select?
> This is what I have while it works its not very elegant
>
> Element.implement({
>    removeOptions: function () {
>        for (var count = this.options.length - 1; count >= 0; count--)
> {
>            this.removeChild(this.options[count]);
>        }
>    }
>
> });
>
> Same problem with adding:
>
>    data.each(function (itm) {
>        try {
>            $('ddArtists').add(new Option(itm.Text, itm.Value),
> null);  // Everything else
>        }
>        catch (ex) {
>            $('ddArtists').add(new Option(itm.Text, itm.Value));  //
> IE (Maybe others)
>        }
>    });
>
> }
>
> --http://tbela99.blogspot.com/
>
> fax : (+33) 08 26 51 94 51
>
> --http://tbela99.blogspot.com/
>
> fax : (+33) 08 26 51 94 51
>
> --http://tbela99.blogspot.com/
>
> fax : (+33) 08 26 51 94 51

Reply via email to