想创建一个非常简单的Grid,数据是hard-code进去的..
相关的js代码如下:
Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'名称',dataIndex:'name'},
{header:'描述',dataIndex:'descn'}
]);
var data2 = [
['1','name1','descn1'],
['2','name2','descn2'],
['3','name3','descn3'],
['4','name4','descn4'],
['5','name5','descn5']
];
var store = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data2),
reader: new Ext.data.ArrayReader({},[
{name:'id'},
{name:'name'},
{name:'descn'}
])
});
store.load();
var grid = new Ext.grid.GridPanel({
renderTo: 'grid',
store: store,
cm: cm
});
});
页面上这个Grid中的数据死活显示不完全,只能显示第一行的....
用Firebug去审查一下元素,发现数据是已经加载上来的,但是由于Grid高度的限制,没有显式完全:
原来是由于GridPanel的autoHeight属性搞的鬼,我在创建GridPanel时把它显式置成true,就可以了.
var grid = new Ext.grid.GridPanel({
autoHeight: true,
renderTo: 'grid',
store: store,
cm: cm
});
顺便贴上使用它的一些注意事项(摘自官网):
true
to use height:'auto', false
to use fixed height (defaults to false
). Note: Setting autoHeight: true
means that the browser will manage the panel's height based on its contents, and that Ext will not manage it at all. If the panel is within a layout that manages dimensions (fit
, border
, etc.) then setting autoHeight: true
can cause issues with scrolling and will not generally work as expected since the panel will take on the height of its contents rather than the height required by the Ext layout.
分享到:
相关推荐
一个extjs的OA项目 extjs-OA extjs-oaextjs-OA extjs-oa
extjs-620-docs官方文档extjs-620-docs官方文档extjs-620-docs官方文档
extjs-theme-bootstrap-master.zip
extjs-basex.js extjs-basex.js extjs-basex.js
extjs-6.2.0完全离线版本API文档,原本的离线包还是会去请求谷歌的部分js资源和字体资源,导致速度很慢,这个不会了
extjs-4.2.1的基础包.rar,方便自己用.
extjs-basex.js extjs-basex.js extjs-basex.js
extjs-4.1.1 ExtJs所有文档及库文件,在官网下的,这个版本很好,放在这方便大家下载!
extJs-5.0.1-gpl附带sencha cmd安装程序、ruby编译包(分为32位和64位)和教程,一共四部分
extjs-core 3.0 beta版extjs-core 3.0 beta版SDK extjs-core 3.0 beta版extjs-core 3.0 beta版
ExtJS----HelloWorld程序源码
extjs--创建图表 折线图、饼状图、柱状图
extjs-6.5.3离线API文档,是学习和开发的必要工具。希望有所帮助!
ExtJS是一种主要用于创建前端用户界面,是一个基本与后台技术无关的前端ajax框架。功能丰富,无人能出其右。无论是界面之美,还是功能之强,ext的表格控件都高居榜首。单选行,多选行,高亮显示选中的行,推拽改变列...
extjs-7.0.0-gpl
Ext JS 4.2.6.1811 Release Date: October 5, 2016 Version Number: 4.2.6.1811 ext-src class 926
ExtJS是一种主要用于创建前端用户界面,是一个基本与后台技术无关的前端ajax框架。序言 功能丰富,无人能出其右。 无论是界面之美,还是功能之强,ext的表格控件都高居榜首
EXTJS---完整数据库代码,全网唯一,非常适合EXTJS搭建框架,包含动态树,菜单,集成SPIRNGMVC+exjs+jdbc 等
extjs-4.1.1官方完整包!包含智能提示功能。
extjs-4.1.1 源码,里面包括,源代码,API文档,实例等。extjs-4.1.1 源码下载、文档