Re: looking for suggestions on retaining comoboboxvalues even after pageload
Claudio D'angelo <claudio.dangelo <at> lispa.it>
2009-02-02 11:51:35 GMT
ComboBox is an InputBox with auto complete. If you want key/value
selection you can use the dojox.form.DropDownSelect (example):
<script type="text/javascript">
dojo.require("dojox.form.DropDownSelect");
dojo.require("dojo.data.ItemFileReadStore");
function init() {
var selectedValue = "C1"; <-- the code
dataStore.fetch( onItem: function(item) {
myDataId.addOption({value : dataStore.getValue(item,
"code"), label: dataStore.getValue(item, "name")});
}
, onComplete:function(){
myDataId.attr("value", selectedValue);
}
});
}
dojo.addOnLoad(init);
</script>
</head>
<body class="tundra">
<div dojoType="dojo.data.ItemFileReadStore" jsId="dataStore"
url="simpleData.json"></div>
<input dojoType="dojox.form.DropDownSelect" name="myData" id="myDataId"
jsid="myDataId" />
kenny ha scritto:
> GaRaGeD Style a écrit :
>> On Fri, Jan 30, 2009 at 3:33 AM, venkatesh rao <venky034 <at> yahoo.co.in> wrote:
>>
>>> Hi Claudio,
>>>
>>>
>>>
>>> I am working on java and I tried to use the syntax which you suggested but
>>> this is not working.
>>>
>>>
>>>
>>> dijit.byId('myComboBoxId').setValue(
>>>
>>> <%= "Welcome"%>);
>>>
>>>
>>>
>>> This gives Welcome undefined.
>>>
>>>
>>
>> You are missing quotes:
>> ...setValue('<%= "Welcome"%>');
>>
>>
>> I still have a similar problem,I try to put (via setValue or
>> attr('value'...) but the combo displays what I put as value.
>>
>> If i put
>> dijit.byId('combo').attr('value', 15);
>>
>> The combo displays "15", instead of the actual value corresponding to the 15 ID.
>>
>> I can set the "DisplayedValue", but doesn't make sense, and doesn't
>> appear to actually select the corresponding row.
>>
>> Max
>>
>
> dijit.byId('combo').attr('value', 15); should be ok.
> value -> set the id of the combo list to 15
> displayedValue (with lower d at beginnning) -> set the record that has the visible value to 15
>
> Can you show us a bit of your json data behind your comboBox.
>
> Kenny
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest <at> dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>
--
__________________________________
Claudio D'Angelo
Programmatore
Direzione Sviluppo Area di Staff Tecnologie
Lombardia Informatica S.p.A.
Via Don G. Minzoni, 24
20158 Milano ITALY
www.lispa.it
Mail: claudio.dangelo <at> lispa.it
Office: +39 02 39331 485
Fax: +39 02 39331 250
__________________________________
Le informazioni contenute in questo messaggio e ogni documento o file ad esso allegato sono riservati e
confidenziali. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio o a diversa
persona da questo autorizzata, per le finalità indicate nel messaggio medesimo. Qualora Lei non fosse
la persona cui il presente messaggio è destinato, La invitiamo a eliminarlo dal Suo Sistema e a
distruggere le varie copie o stampe, dandocene gentilmente comunicazione. Ogni utilizzo improprio è
contrario ai principi del D.Lgs. 196/03 e alla legislazione europea (Direttiva 2002/58/CE). Lombardia
Informatica S.p.A. opera in conformità al D.Lgs. 196/2003 citato. Per qualsiasi informazione a
riguardo si prega di contattare la nostra Società al seguente indirizzo e-mail: info <at> lispa.it
The information contained in this message, as well as any attached file(s), is private and confidential
and is only intended for the person to whom it is addressed. If the reader of this message is not the intended
recipient or the employee or agent responsible for delivering the message to the intended recipient, or
you have received this communication in error, please be aware that any dissemination, distribution or
duplication is strictly prohibited, and may be illegal. Please notify us immediately and delete all
copies from your mailbox and other archives. Thank you.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest <at> dojotoolkit.org
http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest