javascript-Ext js组合框帮助

我正在尝试使用Ext Js定义一个下拉列表框,该下拉列表将显示保存在数组中的“假日”.请更正我可能会出错的地方,因为JSP不会显示下拉列表组合框.

  ...
  <body>
  <div class="left " style="color:#333333;padding-bottom:8px;padding-left:13px;width:99%;" id="Holiday">        

  <span class="formastrickmargin"><strong></strong></span>
  </div>
  <div id="Holiday" class="left " style="padding-bottom:6px;padding-left:15px;width:99%;">

  </div>
   </body>

  <script type="text/javascript">   
  var availableTags = ["New years Day", "Martin Luther King Day", "Groundhog Day", "Valentine's Day", "Washington's Birthday", 
                 "Easter", "Earth Day", "National Arbor Day", "Mother's Day", "Memorial Day", "Flag Day", "Father's Day", 
                 "Independence Day", "Labor Day", "Columbus Day", "Halloween", "Veterans Day", "Thanksgiving Day"];
   var combo1;
   var defaultDDText = 'Enter the Site Id here, or select from dropdown.';
   var Holidaystore = new Ext.data.ArrayStore({
         root: 'availableTags',
         autoLoad:true,
         fields: ['availableTags'],
         data: availableTags
        });


   Ext.onReady(function(){
   Ext.QuickTips.init();
   function initializeHoliday(){

    combo1 = new Ext.form.ComboBox({ 
            id:'Holiday',
            typeAhead: true,  
            triggerAction: 'all',
            emptyText: defaultDDText,
            store:Holidaystore,
            selectOnFocus:true,
            width:408,
            listWidth: '410',               
            mode: 'local',
            minChars : '3',
            renderTo:'Holiday',
            displayField: 'availableTags',

}); }
initializeHoliday();  
});

 </script>

解决方法:

我将从删除root开始:

var availableTags = { 
  data : ["New years Day", "Martin Luther King Day", "Groundhog Day", 
          "Valentine's Day", "Washington's Birthday", "Easter", "Earth Day", 
          "National Arbor Day", "Mother's Day", "Memorial Day", "Flag Day", 
          "Father's Day", "Independence Day", "Labor Day", "Columbus Day", 
          "Halloween", "Veterans Day", "Thanksgiving Day"]
}; 

下一个根:数据

上一篇:CodeGo.net>使用LINQ过滤ComboBox.DataSource?


下一篇:JQuery EasyUI内Combobox的onChange事件