Extjs怎么在panel面板里面设置滚动条

Extjs怎么在panel面板里面设置滚动条,第1张

设置scrollable:true.

如果内容超过panel的宽度、高度就会出现滚动条

scrollable : Boolean/String/Object

Configuration options to make this Component scrollable. Acceptable values are:

true to enable auto scrolling.

false (or null) to disable scrolling - this is the default.

x or horizontal to enable horizontal scrolling only

y or vertical to enable vertical scrolling only

Also accepts a configuration object for a Ext.scroll.Scroller if if advanced configuration is needed.

The getter for this config returns the Scroller instance. You can use the Scroller API to read or manipulate the scroll position:

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

}

})

你用了tbar就没想到bbar?

dockedItems:[{

xtype:'pagingtoolbar',

store:'QueryFindPointStore',

dock:'bottom',

displayInfo:true,

displayMsg:'显示 {0} - {1}条记录,总共 {2}条记录',

emptyMsg:'暂无数据'

}],

换成

bbar:{

xtype:'pagingtoolbar',

store:'QueryFindPointStore',

displayInfo:true,

displayMsg:'显示 {0} - {1}条记录,总共 {2}条记录',

emptyMsg:'暂无数据'

},


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

原文地址: http://outofmemory.cn/bake/11663411.html

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

发表评论

登录后才能评论

评论列表(0条)

保存