ExtJs4.0 grid store用 ajax 请求数据能显示不能分页了 看代码
时间:2011-06-20
来源:互联网
/// <reference path="vswd-ext_2.0.2.js" />
/**************************************/
Ext.Loader.setConfig({ enabled: true });
Ext.Loader.setPath('Ext.ux', '../extjs/ux');
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.util.*',
'Ext.ux.data.PagingMemoryProxy',
'Ext.ux.ProgressBarPager'
]);
/**************************************/
Ext.onReady(function () {
/*********************************/
var myData = [['1', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['15', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['16', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['17', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['18', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['19', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['20', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['21', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['22', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['23', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['24', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['25', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['26', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['27', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00']];
Ext.define('Company', {
extend: 'Ext.data.Model',
idProperty: 'company',
fields: [
{ name: 'NoteId' },
{ name: 'NoteTitle'},
{ name: 'NoteContent' },
{ name: 'CreateTime'}
]
});
var store = Ext.create('Ext.data.Store', {
model: 'Company',
remoteSort: true,
pageSize: 10,
proxy: {
type: 'ajax',
url: '../ExtData/Mymemo.ashx?oper=list',
reader: {
type: 'array'
}
}
// 这样就可以显示和分页 ajax 就不行了
// proxy: {
// type: 'pagingmemory',
// data: myData,
// reader: {
// type: 'array'
// }
// }
});
/*********/
var grid = Ext.create('Ext.grid.Panel', {
title: '我的便签列表',
dockedItems: [{
xtype: 'toolbar',
items: [{
iconCls: 'icon-add',
text: '添加便签',
scope: this,
handler: function () {
Ext.MessageBox.alert('d', 'c');
}
}]
}],
store: store,
collapsible: true, //是否折叠
columns: [{
id: 'company',
text: '编号',
sortable: true,
dataIndex: 'NoteId',
width: 75
//flex: 1
}, {
text: '标题',
sortable: true,
dataIndex: 'NoteTitle',
width: 100
}, {
text: '内容',
sortable: true,
// renderer: change, //可以处理穿来的数据 函数名称
dataIndex: 'NoteContent',
width: 200
}, {
text: '时间',
sortable: true,
// renderer: pctChange,
dataIndex: 'CreateTime',
width: 150
}],
stripeRows: true,
height: 420,
width: '100%',
frame: true,
bbar: Ext.create('Ext.PagingToolbar', {
pageSize: 10,
store: store,
displayInfo: true,
plugins: Ext.create('Ext.ux.ProgressBarPager', {})
})
});
grid.render('Grid_div');
store.load();
/********************************************/
});
不太明白是为什么 请各位帮忙解决下
下面是页面返回的数据
[['1', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['15', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['16', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['17', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['18', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['19', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['20', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['21', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['22', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['23', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['24', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['25', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['26', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['27', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00']]
/**************************************/
Ext.Loader.setConfig({ enabled: true });
Ext.Loader.setPath('Ext.ux', '../extjs/ux');
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.util.*',
'Ext.ux.data.PagingMemoryProxy',
'Ext.ux.ProgressBarPager'
]);
/**************************************/
Ext.onReady(function () {
/*********************************/
var myData = [['1', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['15', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['16', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['17', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['18', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['19', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['20', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['21', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['22', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['23', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['24', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['25', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['26', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],
['27', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00']];
Ext.define('Company', {
extend: 'Ext.data.Model',
idProperty: 'company',
fields: [
{ name: 'NoteId' },
{ name: 'NoteTitle'},
{ name: 'NoteContent' },
{ name: 'CreateTime'}
]
});
var store = Ext.create('Ext.data.Store', {
model: 'Company',
remoteSort: true,
pageSize: 10,
proxy: {
type: 'ajax',
url: '../ExtData/Mymemo.ashx?oper=list',
reader: {
type: 'array'
}
}
// 这样就可以显示和分页 ajax 就不行了
// proxy: {
// type: 'pagingmemory',
// data: myData,
// reader: {
// type: 'array'
// }
// }
});
/*********/
var grid = Ext.create('Ext.grid.Panel', {
title: '我的便签列表',
dockedItems: [{
xtype: 'toolbar',
items: [{
iconCls: 'icon-add',
text: '添加便签',
scope: this,
handler: function () {
Ext.MessageBox.alert('d', 'c');
}
}]
}],
store: store,
collapsible: true, //是否折叠
columns: [{
id: 'company',
text: '编号',
sortable: true,
dataIndex: 'NoteId',
width: 75
//flex: 1
}, {
text: '标题',
sortable: true,
dataIndex: 'NoteTitle',
width: 100
}, {
text: '内容',
sortable: true,
// renderer: change, //可以处理穿来的数据 函数名称
dataIndex: 'NoteContent',
width: 200
}, {
text: '时间',
sortable: true,
// renderer: pctChange,
dataIndex: 'CreateTime',
width: 150
}],
stripeRows: true,
height: 420,
width: '100%',
frame: true,
bbar: Ext.create('Ext.PagingToolbar', {
pageSize: 10,
store: store,
displayInfo: true,
plugins: Ext.create('Ext.ux.ProgressBarPager', {})
})
});
grid.render('Grid_div');
store.load();
/********************************************/
});
不太明白是为什么 请各位帮忙解决下
下面是页面返回的数据
[['1', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['15', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['16', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['17', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['18', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['19', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['20', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['21', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['22', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['23', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['24', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['25', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['26', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00'],['27', '试试', '嗯 这就是一个记事本 呵呵 挺好的', '2011-6-15 0:00:00']]
作者: yang296264808 发布时间: 2011-06-20
帮顶 避免杯具
作者: inetfuture 发布时间: 2011-06-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28