1
votes

I am using an inline filteringselect with datastore, as follows:

I am using ABBR as the identifier and NAME as the value.

The filtering selects and works correctly, but I have two issues.

  1. Firstly, how do I retrieve the ABBR for the selected option NAME? I have tried various things, including .innerHTML but that only retrieves the selected item name, not the identifier.

  2. Secondly, when using the datastore option, how can I choose the default selected item, for example if it was a scale of 1 to 10 and I wanted 5 as the default selection, how can I do this?

Any ideas and advice would be greatly appreciated.

Mank thanks

1
code example: <div dojoType="dojo.data.ItemFileReadStore" jsId="actionStore" data="actionStoreData"> </div> <span dojoType="dijit.InlineEditBox" editor="dijit.form.FilteringSelect" store="actionStore" editorParams="{store: actionStore, autoComplete: true}" width="280px" id="frm_company_action"></span> - Gavin Cotton

1 Answers

0
votes
    dojo.addOnLoad(function() { 
            // inline store
    str = new dojo.data.ItemFileReadStore({data: storeData10})
            var itmes;
        // for storing the store's items    
                str.fetch({
                onComplete:function(itms){
                    itmes= itms;
                    console.log(itms)
                }
            })
            dijit.byId("cmbx1").store = str
            dojo.connect(dijit.byId("cmbx1"), 'onChange',function(){
                //console.log(arguments);
                                    //get the value u c in screen
                var whatvseeinselect = dijit.byId("cmbx1").focusNode.value;

   dojo.forEach(itmes, function(itm){
//compare the value u c in screen with store itms. once matched take that item and get the name attr or other attr if u require..
                    if(whatvseeinselect == str.getValue(itm,"name")){
                        console.log(str.getValue(itm,"name"));
                    }
                })
            })
        });

I'm not sure whether this is the correct way. Hope this helps