如题疑问,下面贴代码:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>RaidoGroup/CheckBoxGroup/ComboBox</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link rel="stylesheet" type="text/css"
href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/bootstrap.js">
</script>
<script type="text/javascript" src="extjs/ext-all.js">
</script>
</head>
<body>
<div id='checkBoxDiv'></div>
<div id='radioDiv'></div>
<div id='comboBoxDiv'></div>
<script type="text/javascript">
Ext.onReady(function() {
var checkBoxGroup = Ext.create('Ext.form.CheckboxGroup', {
width : 300,
name:'rb',
items : [ {
boxLabel : 'Item 1',
inputValue : '1'
}, {
boxLabel : 'Item 2',
inputValue : '2',
checked : true
}]
});var radioGroup = Ext.create('Ext.form.RadioGroup',{
width:300,
items: [
{ boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true}
]
});var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"}
]
});var comboBox = Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr'
});/**
* checkBoxGroup 行2放置行3下方即报错:Uncaught TypeError: Cannot read property 'dom' of null
*/
var checkBoxGroupDiv = document.createElement('DIV');//行1
document.getElementById('checkBoxDiv').appendChild(checkBoxGroupDiv);//行2
checkBoxGroup.render(checkBoxGroupDiv);//行3
//----------------------------raidoGroup
var radioGroupDiv = document.createElement('DIV');
document.getElementById('radioDiv').appendChild(radioGroupDiv);
radioGroup.render(radioGroupDiv);//----------------------------comboBox
/***
* 我的疑问:行2 和行3(可以换行也就是所我将两行调换依旧不像上面俩组件一样报那样的错) 但是checkboxGroup以及 raidoGroup为何会报错?
* 复选、单选组以及下拉的渲染有什么不同么?
*/
var comboBoxDiv = document.createElement('DIV');
document.getElementById('comboBoxDiv').appendChild(comboBoxDiv);//行2
comboBox.render(comboBoxDiv);//行3});
</script>
</body>
</html>
//------------------------------------------------------------------------问题在注释内有解释。另外我怀疑是不是extjs的bug.......这里先感谢“黄灯桥”老师今晚帮助。具体解释为什么希望有人帮忙解释下!(就200分,希望尽快结贴)
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>RaidoGroup/CheckBoxGroup/ComboBox</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link rel="stylesheet" type="text/css"
href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/bootstrap.js">
</script>
<script type="text/javascript" src="extjs/ext-all.js">
</script>
</head>
<body>
<div id='checkBoxDiv'></div>
<div id='radioDiv'></div>
<div id='comboBoxDiv'></div>
<script type="text/javascript">
Ext.onReady(function() {
var checkBoxGroup = Ext.create('Ext.form.CheckboxGroup', {
width : 300,
name:'rb',
items : [ {
boxLabel : 'Item 1',
inputValue : '1'
}, {
boxLabel : 'Item 2',
inputValue : '2',
checked : true
}]
});var radioGroup = Ext.create('Ext.form.RadioGroup',{
width:300,
items: [
{ boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true}
]
});var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"}
]
});var comboBox = Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr'
});/**
* checkBoxGroup 行2放置行3下方即报错:Uncaught TypeError: Cannot read property 'dom' of null
*/
var checkBoxGroupDiv = document.createElement('DIV');//行1
document.getElementById('checkBoxDiv').appendChild(checkBoxGroupDiv);//行2
checkBoxGroup.render(checkBoxGroupDiv);//行3
//----------------------------raidoGroup
var radioGroupDiv = document.createElement('DIV');
document.getElementById('radioDiv').appendChild(radioGroupDiv);
radioGroup.render(radioGroupDiv);//----------------------------comboBox
/***
* 我的疑问:行2 和行3(可以换行也就是所我将两行调换依旧不像上面俩组件一样报那样的错) 但是checkboxGroup以及 raidoGroup为何会报错?
* 复选、单选组以及下拉的渲染有什么不同么?
*/
var comboBoxDiv = document.createElement('DIV');
document.getElementById('comboBoxDiv').appendChild(comboBoxDiv);//行2
comboBox.render(comboBoxDiv);//行3});
</script>
</body>
</html>
//------------------------------------------------------------------------问题在注释内有解释。另外我怀疑是不是extjs的bug.......这里先感谢“黄灯桥”老师今晚帮助。具体解释为什么希望有人帮忙解释下!(就200分,希望尽快结贴)
解决方案 »
- 怎么在html调用url参数?
- 这个正则表达式是什么意思: /^\s*(.*?)\s+$/
- 请教一个问题:如何动态生成输入文本框(每行两个),每次点击ADD增加一行,并且用每行的第一列乘以第二列的和除以所有第二列的和。
- 哪位对JS的$.post很熟?请帮我看看这段程序是什么意思,谢谢++++++++++++++++++
- 真的没分了,帮我看看这里应该怎么写呢!急!!!!
- 多个iframe,如何根据包含的内容的高和宽决定iframe的高度
- 用js写的下拉菜单遮不住<select>下拉列表,各位有什莫好办法吗?
- 怎么样检测单选框是否已经选中
- 怎样通过动态改变CSS位置属性的方法设计一个实现简单动画的Javaseript程序?To:[email protected]
- 关于修改prototype 原型污染的问题,求解
- 求助,大家帮忙解决一个JS网址加密的问题,
- javascript新手问题 ! 简单的关键字搜索
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"><title>RaidoGroup/CheckBoxGroup/ComboBox</title><meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link rel="stylesheet" type="text/css"
href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/bootstrap.js">
</script>
<script type="text/javascript" src="extjs/ext-all.js">
</script></head>
<body>
<div id='checkBoxDiv'></div>
<div id='radioDiv'></div>
<div id='comboBoxDiv'></div>
<script type="text/javascript">
Ext.onReady(function() {
var checkBoxGroup = Ext.create('Ext.form.CheckboxGroup', {
width : 300,
name:'rb',
items : [ {
boxLabel : 'Item 1',
inputValue : '1'
}, {
boxLabel : 'Item 2',
inputValue : '2',
checked : true
}]
});var radioGroup = Ext.create('Ext.form.RadioGroup',{
width:300,
items: [
{ boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true}
]
});var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"}
]
});var comboBox = Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr'
});/**
* checkBoxGroup 行2放置行3下方即报错:Uncaught TypeError: Cannot read property 'dom' of null
*/
var checkBoxGroupDiv = document.createElement('DIV');//行1
document.getElementById('checkBoxDiv').appendChild(checkBoxGroupDiv);//行2
checkBoxGroup.render(checkBoxGroupDiv);//行3
//----------------------------raidoGroup
var radioGroupDiv = document.createElement('DIV');
document.getElementById('radioDiv').appendChild(radioGroupDiv);
radioGroup.render(radioGroupDiv);//----------------------------comboBox
/***
* 我的疑问:行2 和行3(可以换行也就是所我将两行调换依旧不像上面俩组件一样报那样的错) 但是checkboxGroup以及 raidoGroup为何会报错?
* 复选、单选组以及下拉的渲染有什么不同么?
*/
var comboBoxDiv = document.createElement('DIV');
document.getElementById('comboBoxDiv').appendChild(comboBoxDiv);//行2
comboBox.render(comboBoxDiv);//行3});
</script>
</body>
</html>ext4的bug确实不少,我之前也问了不少问题,很多都是bug造成的无解,后面版本升级后就解决了。
也可以调试一下,看下源码,本人水平有限,看源码能力差点,大虾可以试下