ext js 代码全解读。谢谢高手。我急用啊。 5
Ext.onReady(function(){myPagerSize=20;//注释:varuserRecords=newExt.data.Record.create([...
Ext.onReady(function() {
myPagerSize = 20;
//注释:
var userRecords = new Ext.data.Record.create([{
name : "id"
}, {
name : "bankName"
name : "bankNum"
//注释:
var reader = new Ext.data.JsonReader({
otalProperty : "total",
root : "addBanks"
}, userRecords);
//注释:
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : './addBank.do?method=list'
reader : reader,
remoteSort : true
store.load({
params : {
start : 0,
imit : myPagerSize
//注释:
var gridbar = new Ext.Toolbar({
id : 'gridbar',
items : [{
xtype : 'button',
text : '添加',
iconCls : 'add',
handler : function() {
doAddUser();
xtype : 'button',
text : '修改',
iconCls : 'save',
handler : function() {
var rows = grid.selModel.getSelections();
if ((rows.length == 0)) {
Ext.Msg.alert("提示消息", "选择您要修改的银行<br/>暂时不支持该功能!");
return false;
if ((rows.length >= 2)) {
Ext.Msg.alert("提示消息", "将要修改的记录id为"
+ rows[0].data.id);
} else {
Ext.Msg.alert("提示消息", "将要修改的记录id为"
+ rows[0].data.id);
xtype : 'button',
text : '删除',
iconCls : 'remove',
handler : function() {
var rows = grid.selModel.getSelections();
if (!(rows.length >= 1)) {
Ext.Msg
.alert("提示消息",");
return false;
Ext.Msg.confirm("确认消息框",, function(
btn, txt) {
if (btn == "no")
return false;
else {
var Ids = "";
for (var i = 0; i < rows.length; i++) {
ds += rows[i].data.id + ",";// 获取批量删除所需要的ID
Ext.MessageBox.wait("正在删除数据,请稍候。。。。。。",
"请稍后");
Ext.Ajax.request({
url : './addBank.do?method=del',
success : function() {
Ext.Msg.alert('提示',
'操作成功');
store.reload()},
failure : function(action,
form) {
Ext.Msg.alert('请求错误',
'服务器未响应,请稍后再试');
params : {
id : Ids
//注释:
var grid = new Ext.grid.GridPanel({
tbar : gridbar,
store : store,
sm : sm,
colModel : colModel,
viewConfig : {
forceFit : true
stripeRows : true,
autoExpandColumn : "id",
autoHeight : true
//注释:
var pagingtool = new Ext.PagingToolbar({
pageSize : myPagerSize,
store : store,
displayInfo : true,
displayMsg : '显示第 {0} 条到 {1} 条记录,一共 {2} 条'
//注释:
var myPanel = new Ext.Panel({
tbar : toolbar,
items : grid,
bbar : pagingtool
myPanel.render("grid-list");
//注释:
var myFormWin = function() {
newFormWin = new Ext.Window({
layout : 'fit',
width : 400,
height : 300,
plain : true,
title : '',
items : simpleForm
newFormWin.show();
myFormWin();
//注释:
icon : Ext.Msg.ERROR
text : '重置',
handler : function() {
var record = grid_manager.getSelectionModel()
.getSelected();
if (record) {
managerEditForm.getForm().loadRecord(record);
text : '取消',
handler : function() {
this.ownerCt.ownerCt.hide(); 展开
myPagerSize = 20;
//注释:
var userRecords = new Ext.data.Record.create([{
name : "id"
}, {
name : "bankName"
name : "bankNum"
//注释:
var reader = new Ext.data.JsonReader({
otalProperty : "total",
root : "addBanks"
}, userRecords);
//注释:
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : './addBank.do?method=list'
reader : reader,
remoteSort : true
store.load({
params : {
start : 0,
imit : myPagerSize
//注释:
var gridbar = new Ext.Toolbar({
id : 'gridbar',
items : [{
xtype : 'button',
text : '添加',
iconCls : 'add',
handler : function() {
doAddUser();
xtype : 'button',
text : '修改',
iconCls : 'save',
handler : function() {
var rows = grid.selModel.getSelections();
if ((rows.length == 0)) {
Ext.Msg.alert("提示消息", "选择您要修改的银行<br/>暂时不支持该功能!");
return false;
if ((rows.length >= 2)) {
Ext.Msg.alert("提示消息", "将要修改的记录id为"
+ rows[0].data.id);
} else {
Ext.Msg.alert("提示消息", "将要修改的记录id为"
+ rows[0].data.id);
xtype : 'button',
text : '删除',
iconCls : 'remove',
handler : function() {
var rows = grid.selModel.getSelections();
if (!(rows.length >= 1)) {
Ext.Msg
.alert("提示消息",");
return false;
Ext.Msg.confirm("确认消息框",, function(
btn, txt) {
if (btn == "no")
return false;
else {
var Ids = "";
for (var i = 0; i < rows.length; i++) {
ds += rows[i].data.id + ",";// 获取批量删除所需要的ID
Ext.MessageBox.wait("正在删除数据,请稍候。。。。。。",
"请稍后");
Ext.Ajax.request({
url : './addBank.do?method=del',
success : function() {
Ext.Msg.alert('提示',
'操作成功');
store.reload()},
failure : function(action,
form) {
Ext.Msg.alert('请求错误',
'服务器未响应,请稍后再试');
params : {
id : Ids
//注释:
var grid = new Ext.grid.GridPanel({
tbar : gridbar,
store : store,
sm : sm,
colModel : colModel,
viewConfig : {
forceFit : true
stripeRows : true,
autoExpandColumn : "id",
autoHeight : true
//注释:
var pagingtool = new Ext.PagingToolbar({
pageSize : myPagerSize,
store : store,
displayInfo : true,
displayMsg : '显示第 {0} 条到 {1} 条记录,一共 {2} 条'
//注释:
var myPanel = new Ext.Panel({
tbar : toolbar,
items : grid,
bbar : pagingtool
myPanel.render("grid-list");
//注释:
var myFormWin = function() {
newFormWin = new Ext.Window({
layout : 'fit',
width : 400,
height : 300,
plain : true,
title : '',
items : simpleForm
newFormWin.show();
myFormWin();
//注释:
icon : Ext.Msg.ERROR
text : '重置',
handler : function() {
var record = grid_manager.getSelectionModel()
.getSelected();
if (record) {
managerEditForm.getForm().loadRecord(record);
text : '取消',
handler : function() {
this.ownerCt.ownerCt.hide(); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询