情况一:数据源store 不是从后台读取的 直接写的json字符串data用GridPanel显示数据 能完整的显示出数据
也不要设置GridPanel的高度height属性,能够根据读取的数据条数生成表格数 Ext.onReady(function() {
var data = [ [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] ];
var store = new Ext.data.SimpleStore( {
data : data,
fields : [ "id", "name", "sex", "age" ]
});
var grid = new Ext.grid.GridPanel({
title:"员工信息表",
//height : 300,
//width : 500,
store : store,
columns : [
{header : "编号",dataIndex : "id"},
{header : "用户名",dataIndex : "name"},
{header : "性别",dataIndex : "sex"},
{header : "年龄",dataIndex : "age"}
],
bbar: new Ext.PagingToolbar({
//pageSize: 6,
store: store,
displayInfo: true
}),
renderTo:"hello"
});
});
情况一:数据是从后台取出来的:proxy: new Ext.data.HttpProxy({url: 'loginActiongetData.action'}),
用GridPanel显示数据 数据虽然加载出来了 但是表格数据没显示出来 必须要设置height属性来指定gridpanel的高度
才能显示数据
Ext.onReady(function(){
Ext.QuickTips.init();
var GameRecord = Ext.data.Record.create([
{name: 'productID', type: 'string'},
{name: 'productName', type: 'string'},
{name: 'productCode', type: 'string'}
]);
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'loginActiongetData.action'}),
reader: new Ext.data.JsonReader({
},GameRecord),
remoteSort: true
}); store.load();
var grid = new Ext.grid.GridPanel({
title: '交易信息列表',
store: store,
//width:700,
//height:300,
//autoHeight:false,
columns:[
{header:'编号',dataIndex:'productID'},
{header:'名称',dataIndex:'productName'},
{header:'描述',dataIndex:'productCode'}
],
bbar: new Ext.PagingToolbar({
//pageSize: 6,
store: store,
displayInfo: true
})
,renderTo:'grid3'
});
});为何会出现这样啊???? 都是采用的gridpanel的来显示数据的
为何情况一要不用设置高度height就能显示出数据
而情况二却一定要设置高度height才能显示数据呢????????
这两种情况gridpanel部分完全一样
只有数据源store的获取方式不同而已
也不要设置GridPanel的高度height属性,能够根据读取的数据条数生成表格数 Ext.onReady(function() {
var data = [ [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] , [ '1', 'tom', '男', '29' ], [ '1', 'jack', '男', '25' ],
[ '1', 'lili', '女', '23' ] ];
var store = new Ext.data.SimpleStore( {
data : data,
fields : [ "id", "name", "sex", "age" ]
});
var grid = new Ext.grid.GridPanel({
title:"员工信息表",
//height : 300,
//width : 500,
store : store,
columns : [
{header : "编号",dataIndex : "id"},
{header : "用户名",dataIndex : "name"},
{header : "性别",dataIndex : "sex"},
{header : "年龄",dataIndex : "age"}
],
bbar: new Ext.PagingToolbar({
//pageSize: 6,
store: store,
displayInfo: true
}),
renderTo:"hello"
});
});
情况一:数据是从后台取出来的:proxy: new Ext.data.HttpProxy({url: 'loginActiongetData.action'}),
用GridPanel显示数据 数据虽然加载出来了 但是表格数据没显示出来 必须要设置height属性来指定gridpanel的高度
才能显示数据
Ext.onReady(function(){
Ext.QuickTips.init();
var GameRecord = Ext.data.Record.create([
{name: 'productID', type: 'string'},
{name: 'productName', type: 'string'},
{name: 'productCode', type: 'string'}
]);
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'loginActiongetData.action'}),
reader: new Ext.data.JsonReader({
},GameRecord),
remoteSort: true
}); store.load();
var grid = new Ext.grid.GridPanel({
title: '交易信息列表',
store: store,
//width:700,
//height:300,
//autoHeight:false,
columns:[
{header:'编号',dataIndex:'productID'},
{header:'名称',dataIndex:'productName'},
{header:'描述',dataIndex:'productCode'}
],
bbar: new Ext.PagingToolbar({
//pageSize: 6,
store: store,
displayInfo: true
})
,renderTo:'grid3'
});
});为何会出现这样啊???? 都是采用的gridpanel的来显示数据的
为何情况一要不用设置高度height就能显示出数据
而情况二却一定要设置高度height才能显示数据呢????????
这两种情况gridpanel部分完全一样
只有数据源store的获取方式不同而已
解决方案 »
- 关于input中自动添加内容后光标定位的问题!
- 为什么就不行呢,这么简单的东西?
- javascript中字符串处理问题,急需解答,在线等待
- 很头疼的问题,表单里的隐藏项用javascript怎么检测不到啊?请帮忙啊
- 如何屏蔽掉按钮的onclick事件?
- 为什么我用js无法创建excel对象
- 如何在点击一个按钮后改变表格某一行的背景色?
- 打开浏览器的问题
- 怎样使用attachEvent绑定带参数的函数!?
- <a href="javascript:void(0);" class="button01"></a>这样的是怎么触发js的。怎么找到相应的js
- jQuery Validation插件如何?感觉,没自己用jQuery写方便?
- js循环 内存不断增长的问题,急 在线等,高手帮帮忙
我根本没设置layout啊 都是采用的容器gridpanel默认的 直接显示数据的
不知道为啥情况一要不用设置高度 情况二必须设置高度才能看到表格数据呢