我正在尝试使用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"] };
下一个根:数据
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。