views:

249

answers:

1

Hi,

I have a dojo dijit.filering.select that populates with values from a dojo.data.ItemFileReadStore. Everything is working fine except I would like the filtering select to automatically get populated with the first value in the itemFileReadStore. Currently it is loading them as a list of options that are revealed when you click the down arrow, as per spec. I would instead like filteringSelect to be loaded with the first value. How do I do this? For some reason I cant figure it out. Any help would be hugely appreciated!

Kind Regards Nick Frandsen

<script type="text/javascript">
        function updateOptions(){
            var itemId = dijit.byId("item_select").attr("value");
            var jsonStore = new dojo.data.ItemFileReadStore({ url: "/options/get-options-json/itemId/" + itemId });
            optionSelect.attr("store", jsonStore);
        }
</script>
<select dojoType="dijit.form.FilteringSelect"
        name="option_select"
        id="option_select"
        labelAttr="name"
        required="true"
        jsId="optionSelect">
</select>
A: 

This might work:

optionSelect.attr('displayedValue', itemLabel);

Where itemLabel is the label of the item you wish displayed (will depend on what your datastore looks like internally). That should set both the textbox content and the hidden field (with the corresponding itemValue).

yarmiganosca