extjs中grid滚动条怎么加

extjs中grid滚动条怎么加,第1张

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:bolderline-height:25pxfont-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:leftwidth: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()然后再看下你的效果。

如果这个实例你能运行,但是你机器上的代码不能运行,可否提供一个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

}

})

设置width: 200超过了陪瞎就出现滚动条,

还要设置自芦销空动出现滚斗汪动条autoScrool: true

viewConfig : {forceFit : false}即可

很久没用Ext了,也没法测试效果。我感觉是因为设置了锋昌 width:600, 然后forceFit:true的话,会自动在600的宽度内重新计算每列的列宽比例,这么一来就没滚动条了,而是通过压谈橘缩每列列宽展示在600的范围内。

你银侍扒去了forceFit:true试试。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11977877.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存