extjs 中
与div混用表格标题不显示

z1g2w3i4 2009-09-04 09:05:53
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>可编辑表格editorGridPanel 对普通表格实现可编辑效果 数据源采用一维数组的格式 即json对象的格式</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="ext-2.2/resources/css/ext-all.css"/>
<script type="text/javascript" src="ext-2.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-2.2/ext-all.js"></script>

</head>
<script type="text/javascript">
Ext.onReady(function(){
var data = [
{id:"1",name:"小王",eamil:"xiaowang@easyjf.com",sex:"男",bornDate:"1991-10-3"},
{id:"1",name:"小李",eamil:"xiaoli@easyjf.com",sex:"男",bornDate:"1991-10-6"},
{id:"1",name:"小兰",eamil:"xiaolan@easyjf.com",sex:"女",bornDate:"1991-10-9"},
{id:"1",name:"小刘",eamil:"xiaoliu@easyjf.com",sex:"男",bornDate:"1991-10-12"}
];
///dataFormat("Y-n-j") Y代表年,n代表月,j代表日
var store = new Ext.data.JsonStore({data:data,fields:["id","name","eamil","sex",{name:"bornDate",type:"date",dateFormat:"Y-n-j"}]});

var model = new Ext.grid.ColumnModel([
{header:"姓名",dataIndex:"name",height:50,sortable:true,editor:new Ext.form.TextField({})},
{header:"电子邮件",dataIndex:"eamil",height:50,width:150,sortable:true,editor:new Ext.form.TextField({})},
{header:"性别",dataIndex:"sex",height:50},
{header:"出生日期",dataIndex:"bornDate",width:120,height:50,renderer:Ext.util.Format.dateRenderer("Y年m月d日")}
]);

var grid = new Ext.grid.EditorGridPanel({
renderTo:"hello",
title:"学生基本信息管理",
width:800,
height:600,
cm:model,
store:store,
autoExpandColumn:"3"
});
});
</script>
<body>
<center>
<div id="hello"></div>
</center>
</body>
</html>


以上代码,将 <div id="hello"></div>放到<center></center>内表头就不显示,这样用虽很笨,但我百思不解为什么会出现这样的问题.请精英们指点一下!
...全文
177 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
z1g2w3i4 2009-09-06
  • 打赏
  • 举报
回复
谢谢楼上的回复,但我都试过 ,都不凑果.与环境有关吗.我用的是 ie6,ext2.2.但我估计是DHTML标签和extjs的css的定位方式有冲突的问题.但不确定.请研究过类似问题的人能帮住分析一下.
z1g2w3i4 2009-09-06
  • 打赏
  • 举报
回复
谢楼上,问题解决。但不禁对ie6。问题可能像我上面估计的那样,有待继续研究。
hookee 2009-09-06
  • 打赏
  • 举报
回复
可能要改一下ext-all.css,我这里是改过的,针对iE6。
.x-grid3-header-offset{padding-left:1px;width:10000px;#width:auto;_width:auto;}
power0227 2009-09-05
  • 打赏
  • 举报
回复

<div id="hello" align='center'> </div>
hookee 2009-09-04
  • 打赏
  • 举报
回复
是的,不行的话再调小一点试试看 270。 我这里测下来这个数字可以的
z1g2w3i4 2009-09-04
  • 打赏
  • 举报
回复
你说的意思是:
var grid = new Ext.grid.EditorGridPanel({
renderTo:"hello",
title:"学生基本信息管理",
width:470, height:600,
cm:model,
store:store,
autoExpandColumn:"3"
});


我试了,不行呀
hookee 2009-09-04
  • 打赏
  • 举报
回复
ie测下来有表头的,ff下 grid的width改为 width:470, 就可以显示了

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧