extjs grid添加滚动条

var userGrid = new Ext.grid.GridPanel({
frame:true,
loadMask:true,
tbar:toolbar,
store:userStore,
stripeRows:true,

viewConfig:{
autoFill:true
//forceFit:true
},
。。。。。。
});



new Ext.Viewport({
layout:'border',
items:[{
contentEl:'toptitle',
bodystyle:'background-color:#BBCCEE;',
region:'north',
height:134
},{
//contentEl:'usergrid-div',
region:'center',
layout: 'fit',
border:true,
items:[userGrid]
}]
});

 

 

 

 

 

-------------------------------

var grid = new Ext.grid.GridPanel({
2 autoHeight: true,
3 autoWidth:true,
4 autoScroll: true,
5 title: '<spanstyle=font-weight:bolder;line-height:25px;font-size:18px;><center>“大剂量堵水”措施不同井类型对比表</center></span>',
6 loadMask: true,
7 renderTo: 'grid',
8 store: store,
9 cm: cm,
10 collapsible: true,
11 bbar: new Ext.PagingToolbar({
12 pageSize: 100,
13 store: store,
14 displayInfo: true,
15 displayMsg: '显示第{0}条到第{1}条记录,一共{2}条',
16 emptyMsg: '没有记录'
17 })
18 });
19
20 });
21 </script>
22 </head>
23 <bodystyle=" text-align:center;">
24 <divid="Contain" style="text-align:left;width:1000px;">
25 <divid="grid" style="width:1000px;"></div>
26 </div>
27 </body>

 

 

 

 

autoHeight: true,autoWidth:true这两个属性是不起作用的。这里要Ext的Grid的滚定条必须显示出来就必须设置固定的Grid宽度(以像素为单位)。

Grid中你加入 width: Ext.get("content").getWidth(), height: Ext.get("content").getHeight()然后再看下你的效果。

设置宽和高的办法我已经做过测试,测试的代码可以从http://files.cnblogs.com/Casoul/example.rar这里获取,使用的是Ext3.1.1版本。

如果这个实例你能运行,但是你机器上的代码不能运行,可否提供一个Ext的版本号,以供来测试解决这个问题。

 

这个问题已经解决了,解决方法是把autoHeight: true, autoWidth:true,改成具体的数值就行了。
Ext的Grid宽高必须是给定的明确数值的。

 ------------------

var grid = new Ext.grid.GridPanel( {
renderTo : 'Container',
width : gridWidth,
stripeRows : true,
enableHdMenu:false,
autoScroll : true,
autoHeight : true,
columnLines : true,
store : new Ext.data.ArrayStore( {
fields : fields,
data : gridData
}),
columns : columns,
viewConfig : {
forceFit : true
}
});

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值