本文介绍了Google Dart仅显示特定的DropDown子元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过隐藏一些选择从下拉列表中只获取某些值。显然我不能超过数组索引3或没有显示,显然不低于索引0.我试图隐藏下拉列表中的前三个选择。任何想法将不胜感激。如果您需要更多信息,请告诉我们。



打印输出:


  1. 选择一个选项 - 禁用

  2. 选择1

  3. 选择2

  4. 选择3

  5. li>
  6. 选择5

  7. b
    $ b

     列表< Map> _predefinedFilterList; 
    _predefinedFilterList = jsonObject [jsonResponse] as List< Map> ;;

    for(Map filterMap in _predefinedFilterList){
    dropDownEl.children.add(new OptionElement(data:filterMap [displayName]));

    print(Test:+ filterMap [displayName]);

    // dropDownEl.children [0] .hidden = true;
    // dropDownEl.children [1] .hidden = true;
    // dropDownEl.children [2] .hidden = true;
    }


    解决方案

    第三个子列表之后的项目将删除前三个列表元素。

      _predefinedFilterList.sublist(3).forEach => print(map [displayName])); 


    I'm attempting to get only certain values from a drop-down by hiding a select few. Apparently I cannot go over an array index of 3 or nothing shows up and obviously not below an index of 0. I'm trying to hide the first three choices in the drop-down. Any ideas would be appreciated. Please let me know if you need more information.

    The printout:

    1. Select a choice --disabled
    2. Choice 1
    3. Choice 2
    4. Choice 3
    5. Choice 4
    6. Choice 5

    Code:

      List<Map> _predefinedFilterList;
    _predefinedFilterList = jsonObject["jsonResponse"] as List<Map>;
    
    for (Map filterMap in _predefinedFilterList) {
            dropDownEl.children.add(new OptionElement(data: filterMap["displayName"]));
    
    print("Test: "+filterMap["displayName"]);
    
     //         dropDownEl.children[0].hidden = true;   
     //         dropDownEl.children[1].hidden = true;
    //          dropDownEl.children[2].hidden = true;
          }
    
    解决方案

    This would only go over the items after the 3rd as sublist would remove the first 3 list elements.

    _predefinedFilterList.sublist(3).forEach((map) => print(map["displayName"]));
    

    这篇关于Google Dart仅显示特定的DropDown子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 18:25