1

我正在使用带有数据存储的内联过滤选择,如下所示:

我使用 ABBR 作为标识符,使用 NAME 作为值。

过滤选择并正常工作,但我有两个问题。

  1. 首先,如何检索所选选项 NAME 的 ABBR?我尝试了各种方法,包括 .innerHTML ,但它只检索选定的项目名称,而不是标识符。

  2. 其次,在使用数据存储选项时,如何选择默认选择项,例如,如果它是 1 到 10 的比例,我希望 5 作为默认选择,我该怎么做?

任何想法和建议将不胜感激。

谢谢

4

1 回答 1

0
    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"));
                    }
                })
            })
        });

我不确定这是否是正确的方法。希望这可以帮助

于 2011-05-05T08:10:33.610 回答