Em Sexta 09 Junho 2006 11:50, Arnar Birgisson escreveu:
> I'm not sure if you mean sorting the <option> elements after inserting
> them into the DOM or before. I would do something like this:
Actually, the order in sorting doesn't matter to me if the output appears
sorted to the user :-)
> map(function (key) {
> $('yourselect').appendChild(OPTION({'value': key}, yourjsonobject[key]));
> }, keys(yourjsonobject).sort());
>
> Perhaps there's a better way?
I'm building an array of options and then using replaceChildNodes. But I
believe I can adapt the above function or change my code to appendChildNodes
without much problem...
But if there was an alternative option it would be interesting to know it :-)
Thanks Arnar.
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---