EXT gridPanel遇到的问题??
刚开始学Ext一段时间练练手遇到下面这个问题?我想在一个window中放一个gridpanel,将新建的两个组件放在一起能正常显示,但不知道为什么把这两个组件分开放就不能...
刚开始学Ext 一段时间 练练手 遇到下面这个问题?
我想在一个window中放一个gridpanel,将新建的两个组件放在一起能正常显示,但不知道为什么把这两个组件分开放就不能正常显示了, 本人在网上也看到过有人这么写过,但不知道是哪里出错了,忘懂Ext的请指点!!!谢谢
这是new好的gridpanel ,写在一个单独的js文件中:
//创建grid列header 行的成员
var cb = new Ext.grid.CheckboxSelectionModel();
var cm=new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer({header:"序号",dataIndex:'id',width:40}),cb,
{header:"退货主题",dataIndex:"returnTitle",width:40},
{header:"退货单",dataIndex:"returnId",width:40},
{header:"日期",dataIndex:"returnDate",width:40},
{header:"原采购单",dataIndex:"purchaseId",width:40},
{header:"供应商",dataIndex:"providerName",width:40},
{header:"经手人",dataIndex:"manager",width:40},
{header:"审核状态",dataIndex:"processor",width:40},
{ header : "操作",
width : 35,
dataIndex : '',
menuDisabled : true, // 单击列头后是否出现菜单
renderer:function() {
return "<span style='margin-right:10px'><a href='<%=basePath%>background/purchase/purchaseReturnList.jsp'>审核</a></span><span style='margin-right:10px'><a href='<%=basePath%>background/purchase/purchaseReturnList.jsp'>详情</a></span>";
}}
]);
var data = [
{returnTitle:'ss',returnId:'123',returnDate:'aaa',purchaseId:'个',providerName:'33',manager:'66',processor:'444'},
{returnTitle:'ss',returnId:'123',returnDate:'aaa',purchaseId:'个',providerName:'33',manager:'66',processor:'444'},
{returnTitle:'ss',returnId:'123',returnDate:'aaa',purchaseId:'个',providerName:'33',manager:'66',processor:'444'},
];
var store1 = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.JsonReader({fields:['returnTitle','returnId','returnDate','purchaseId','providerName','manager','processor']})
});
store1.load();
cm.defaultSortable = true;
//分页控件 其实分页还是要后台控制的
var pagingBar = new Ext.PagingToolbar
({
displayInfo:true,emptyMsg:"没有数据显示",displayMsg:"显示从{0}条数据到{1}条数据,共{2}条数据",
store:store1,
pageSize:2
});
// tbar 的创建 加载gridPanle上
},
'退货时间',
]);
//创建gridpanel
var grid = new Ext.grid.GridPanel
({
id:"MenuGridPanel",
renderTo:document.body,
layout:"fit",
frame:true,
border:true,
width : 832,
height : 425,
autoScroll:true,
store:store1,
cm:cm,
sm:cb,
viewConfig:{forceFit: true},
// title:'用户列表',
bbar:pagingBar,
tbar:tb
});
在jsp中引入,代码如下:
<script type="text/javascript" src="<%=basePath%>js/purchase/provider.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
var win2 = new Ext.Window({
layout:'fit',
width:717,
closeAction:'hide',
height:423,
resizable:false,
modal:true,
items:[grid2] 这么写 不行吗??
}); 展开
我想在一个window中放一个gridpanel,将新建的两个组件放在一起能正常显示,但不知道为什么把这两个组件分开放就不能正常显示了, 本人在网上也看到过有人这么写过,但不知道是哪里出错了,忘懂Ext的请指点!!!谢谢
这是new好的gridpanel ,写在一个单独的js文件中:
//创建grid列header 行的成员
var cb = new Ext.grid.CheckboxSelectionModel();
var cm=new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer({header:"序号",dataIndex:'id',width:40}),cb,
{header:"退货主题",dataIndex:"returnTitle",width:40},
{header:"退货单",dataIndex:"returnId",width:40},
{header:"日期",dataIndex:"returnDate",width:40},
{header:"原采购单",dataIndex:"purchaseId",width:40},
{header:"供应商",dataIndex:"providerName",width:40},
{header:"经手人",dataIndex:"manager",width:40},
{header:"审核状态",dataIndex:"processor",width:40},
{ header : "操作",
width : 35,
dataIndex : '',
menuDisabled : true, // 单击列头后是否出现菜单
renderer:function() {
return "<span style='margin-right:10px'><a href='<%=basePath%>background/purchase/purchaseReturnList.jsp'>审核</a></span><span style='margin-right:10px'><a href='<%=basePath%>background/purchase/purchaseReturnList.jsp'>详情</a></span>";
}}
]);
var data = [
{returnTitle:'ss',returnId:'123',returnDate:'aaa',purchaseId:'个',providerName:'33',manager:'66',processor:'444'},
{returnTitle:'ss',returnId:'123',returnDate:'aaa',purchaseId:'个',providerName:'33',manager:'66',processor:'444'},
{returnTitle:'ss',returnId:'123',returnDate:'aaa',purchaseId:'个',providerName:'33',manager:'66',processor:'444'},
];
var store1 = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.JsonReader({fields:['returnTitle','returnId','returnDate','purchaseId','providerName','manager','processor']})
});
store1.load();
cm.defaultSortable = true;
//分页控件 其实分页还是要后台控制的
var pagingBar = new Ext.PagingToolbar
({
displayInfo:true,emptyMsg:"没有数据显示",displayMsg:"显示从{0}条数据到{1}条数据,共{2}条数据",
store:store1,
pageSize:2
});
// tbar 的创建 加载gridPanle上
},
'退货时间',
]);
//创建gridpanel
var grid = new Ext.grid.GridPanel
({
id:"MenuGridPanel",
renderTo:document.body,
layout:"fit",
frame:true,
border:true,
width : 832,
height : 425,
autoScroll:true,
store:store1,
cm:cm,
sm:cb,
viewConfig:{forceFit: true},
// title:'用户列表',
bbar:pagingBar,
tbar:tb
});
在jsp中引入,代码如下:
<script type="text/javascript" src="<%=basePath%>js/purchase/provider.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
var win2 = new Ext.Window({
layout:'fit',
width:717,
closeAction:'hide',
height:423,
resizable:false,
modal:true,
items:[grid2] 这么写 不行吗??
}); 展开
1个回答
展开全部
var win2 = new Ext.Window({
layout:'fit',
el :'win',//加一行
width:717,
closeAction:'hide',
height:423,
resizable:false,
modal:true,
items:[grid2]
});
win2.show();//打开
<body><div id="win"></div></body>//放入jsp页面
用win还是比较麻烦
直接new Ext.Viewport( {
enableTabScroll :true,
layout :"fit",
items : [ grid2 ]
});
看看是不是你要的效果,更方便
layout:'fit',
el :'win',//加一行
width:717,
closeAction:'hide',
height:423,
resizable:false,
modal:true,
items:[grid2]
});
win2.show();//打开
<body><div id="win"></div></body>//放入jsp页面
用win还是比较麻烦
直接new Ext.Viewport( {
enableTabScroll :true,
layout :"fit",
items : [ grid2 ]
});
看看是不是你要的效果,更方便
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询