2010-10-30 92 views
1

我使用与数据存储内嵌是FilteringSelect,如下所示:的Dijit /道场内嵌 - 滤波选择 - 数据存储

我使用缩位作为标识符和NAME作为值。

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

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

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

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

Mank感谢

+0

代码例如:

<跨度的dojoType = “dijit.InlineEditBox” 编辑= “dijit.form.FilteringSelect” 商店= “actionStore” editorParams = “{商店:actionStore,自动完成:真}” 宽度=“280px”id =“frm_company_action”> – 2010-10-30 15:29:42

回答

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

我不知道这是否是正确的方法。 希望这有助于