第一种方法必须在页面上设置div的宽度<div id="grid-example" width="90%"></div>
// create the Grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'}
],
stripeRows: true,
autoExpandColumn: 'company',
height: 350,
//第一种方法:width: Ext.get("grid-example").getWidth(),
//第二种方法
bodyStyle:'width:100%',
title: 'Array Grid',
// config options for stateful behavior
stateful: true,
stateId: 'grid'
});
本文介绍了一种使用ExtJS框架创建网格面板的方法。通过设置div元素的宽度,并利用ExtJS的GridPanel组件实现数据展示。文章提供了两种设置宽度的方式:一是直接通过div元素的宽度属性,二是将body样式设为宽度100%,以适应不同场景的需求。

1895

被折叠的 条评论
为什么被折叠?



