problem in setting the option dojox.form.DropDownSelect

View: New views
2 Messages — Rating Filter:   Alert me  

problem in setting the option dojox.form.DropDownSelect

by lukess :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

  i am using the dojox.form.DropDownSelect in my application and after doing some calculations, i just want to set one of the option in the the drop down to be selected by default.....

the way i am doing is

var dropDown = dijit.byId('testDrDo');
for(var i = 0 ; i < dropDown.options.length; i++)
        {
                if(dropDown.options[i].value == "xyz")
                {
       
                        dropDown.options[i].selected = true;
                        break;
                }

        }

 it comes into the loop and also reaches the point, but unfortunately it's not setting it........

I am stuck at this point, i also tried

dijit.byId('testDrDo').options[i].attr("selected", true);

but even that didn't work...

Regards,
Lokesh

Re: problem in setting the option dojox.form.DropDownSelect

by Nathan Toone-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

try:

dijit.byId('testDrDo').attr("value", "xyz");

-Nathan

On Aug 19, 2009, at 12:18 PM, lukess wrote:

>
> Hi,
>
>  i am using the dojox.form.DropDownSelect in my application and  
> after doing
> some calculations, i just want to set one of the option in the the  
> drop down
> to be selected by default.....
>
> the way i am doing is
>
> var dropDown = dijit.byId('testDrDo');
> for(var i = 0 ; i < dropDown.options.length; i++)
> {
> if(dropDown.options[i].value == "xyz")
> {
>
> dropDown.options[i].selected = true;
> break;
> }
>
> }
>
> it comes into the loop and also reaches the point, but unfortunately  
> it's
> not setting it........
>
> I am stuck at this point, i also tried
>
> dijit.byId('testDrDo').options[i].attr("selected", true);
>
> but even that didn't work...
>
> Regards,
> Lokesh
>
> --
> View this message in context: http://www.nabble.com/problem-in-setting-the-option-dojox.form.DropDownSelect-tp25049351p25049351.html
> Sent from the Dojo mailing list archive at Nabble.com.
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

smime.p7s (3K) Download Attachment