【问题标题】:Dijit/Dojo Inline - Filtering Select - DataStoreDijit/Dojo 内联 - 过滤选择 - 数据存储
【发布时间】:2011-05-05 16:10:33
【问题描述】:

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

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

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

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

  2. 1234563 /p>

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

谢谢

【问题讨论】:

  • 代码示例:

标签: dijit.form dojo


【解决方案1】:
    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"));
                    }
                })
            })
        });

我不确定这是否是正确的方法。 希望这会有所帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-12
    相关资源
    最近更新 更多