下面是我的代码
/*这个person 就是请求报文 和响应报文的模型 是我自己找的例子 所以名字没有改
*/Ext.define('Person', {
extend: 'Ext.data.Model',
fields: ['NODESEQ','GROUPCODE','NODECODE','META','ISLOOP','ISNULL','COMPMODE','ISENCRYPT','ISMAB'], validations: [{
type: 'length',
field: 'NODESEQ',
min: 1
}, {
type: 'length',
field: 'GROUPCODE',
min: 1
}, {
type: 'length',
field: 'NODECODE',
min: 1
}, {
type: 'length',
field: 'META',
min: 1
}, {
type: 'length',
field: 'ISLOOP',
min: 1
}, {
type: 'length',
field: 'ISNULL',
min: 1
}, {
type: 'length',
field: 'NODECODE',
min: 1
}, {
type: 'length',
field: 'NODECODE',
min: 1
}]
});
Ext.define('succ', {
extend: 'Ext.data.Model',
fields: ['RETGROUPCODE','RETNODECODE','SUCCRETCODE'], validations: [
{
type: 'length',
field: 'RETGROUPCODE',
min: 1
}, {
type: 'length',
field: 'RETNODECODE',
min: 1
}, {
type: 'length',
field: 'SUCCRETCODE',
min: 1
}]
});var store;//请求
var rspstore;//应答
var succstore;//成功
Ext.onReady(function(){
var demoStore = Ext.create('Ext.data.Store', {
// autoLoad: true,//是否自动加载
autoSync: true,//是否自动同步
fields: [
{ name:'METANM' },{ name:'METAID' }
],
proxy : {
type : 'ajax',// 使用ajax请求
url :'get_ESB_META_DATA.do',// 请求后台读取数据的地址
// 读取数据的工具(数据代理)
reader: {
type:'json',
root: 'rows'
}
},
autoLoad: true
});
//英文改成中文
Ext.grid.RowEditor.prototype.saveBtnText = "保存";
Ext.grid.RowEditor.prototype.cancelBtnText = '取消';
/////////////以下请求///////////////////////
store = Ext.create('Ext.data.Store', {
autoLoad: true,//是否自动加载
autoSync: true,//是否自动同步
model: 'Person',//解析数据的模型,模型可以代替proxy和fields配置
data:[]
});
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing');
var grid = Ext.create('Ext.grid.Panel', {
renderTo: 'req',
plugins: [rowEditing],
//width:400,
height: 200,
frame: true,
title: '请求报文',
store: store,
columns: [{ text: '节点顺序号',
flex: 1,
sortable: true,
dataIndex: 'NODESEQ',
field: {
xtype: 'textfield'
}
}, {
header: '节点组代码',
flex: 1,
sortable: true,
dataIndex: 'GROUPCODE',
field: {
xtype: 'textfield'
}
},
{
header: '节点代码',
flex: 1,
sortable: true,
dataIndex: 'NODECODE',
field: {
xtype: 'textfield'
}
}, {
header: '元数据',
flex: 1,
sortable: true,
dataIndex: 'META',
field: {
xtype: 'combo',
store: demoStore,
displayField:"METAID",
valueField:"METANM"
}
},
{
header: '是否循环节点',
flex: 1,
sortable: true,
dataIndex: 'ISLOOP',
field: {
xtype: 'combo',
store: [['1-循环','循环'],['2-不循环','不循环']]
}
},
{
header: '是否可以为空',
flex: 1,
sortable: true,
dataIndex: 'ISNULL',
field: {
xtype: 'combo',
store: [['1-可以为空','可以为空'],['2-不能为空','不能为空']]
}
},
{
header: '补齐方式',
flex: 1,
sortable: true,
dataIndex: 'COMPMODE',
field: {
xtype: 'combo',
store: [['00-不补齐','不补齐'],
['01-左补零','左补零'],
['02-右补零','右补零'],
['03-左补空格','左补空格'],
['04-右补空格','右补空格']
]
}
},
{
header: '是否加密',
flex: 1,
sortable: true,
dataIndex: 'ISENCRYPT',
field: {
xtype: 'combo',
store: [['1-加密','加密'],['2-不加密','不加密']]
}
},
{
header: '是否参与计算MAC',
flex: 1,
sortable: true,
dataIndex: 'ISMAB',
field: {
xtype: 'combo',
store: [['1-参与计算MAC','参与计算MAC'],['2-不参与计算MAC','不参与计算MAC']]
}
}
],
dockedItems: [{
xtype: 'toolbar',
items: [{
text: '添加',
iconCls: 'icon-add',
handler: function(){
// empty record
store.insert(0,new Person());
rowEditing.startEdit(0, 0);
}
}, '-', {
itemId: 'delete',
text: '删除',
iconCls: 'icon-delete',
disabled: true,
handler: function(){
var selection = grid.getView().getSelectionModel().getSelection()[0];
if (selection) {
store.remove(selection);
}
}
}]
}]
});
grid.getSelectionModel().on('selectionchange', function(selModel, selections){
grid.down('#delete').setDisabled(selections.length === 0);
});
///////////以上请求//////////
///////////以下应答//////////
var rsprowEditing = Ext.create('Ext.grid.plugin.RowEditing');
rspstore = Ext.create('Ext.data.Store', {
autoLoad: true,//是否自动加载
autoSync: true,//是否自动同步
model: 'Person',//解析数据的模型,模型可以代替proxy和fields配置
data:[]
});
var reqgrid = Ext.create('Ext.grid.Panel', {
renderTo: 'rsp',
plugins: [rsprowEditing],
//width:400,
height: 200,
frame: true,
title: '应答报文',
store: rspstore,
columns: [{ text: '节点顺序号',
flex: 1,
sortable: true,
dataIndex: 'NODESEQ',
field: {
xtype: 'textfield'
}
}, {
header: '节点组代码',
flex: 1,
sortable: true,
dataIndex: 'GROUPCODE',
field: {
xtype: 'textfield'
}
},
{
header: '节点代码',
flex: 1,
sortable: true,
dataIndex: 'NODECODE',
field: {
xtype: 'textfield'
}
}, {
header: '元数据',
flex: 1,
sortable: true,
dataIndex: 'META',
field: {
xtype: 'combo',
store: demoStore,
displayField:"METAID",
valueField:"METANM"
}
},
{
header: '是否循环节点',
flex: 1,
sortable: true,
dataIndex: 'ISLOOP',
field: {
xtype: 'combo',
store: [['1-循环','循环'],['2-不循环','不循环']]
}
},
{
header: '是否可以为空',
flex: 1,
sortable: true,
dataIndex: 'ISNULL',
field: {
xtype: 'combo',
store: [['1-可以为空','可以为空'],['2-不能为空','不能为空']]
}
},
{
header: '补齐方式',
flex: 1,
sortable: true,
dataIndex: 'COMPMODE',
field: {
xtype: 'combo',
store: [['00-不补齐','不补齐'],
['01-左补零','左补零'],
['02-右补零','右补零'],
['03-左补空格','左补空格'],
['04-右补空格','右补空格']
]
}
},
{
header: '是否加密',
flex: 1,
sortable: true,
dataIndex: 'ISENCRYPT',
field: {
xtype: 'combo',
store: [['1-加密','加密'],['2-不加密','不加密']]
}
},
{
header: '是否参与计算MAC',
flex: 1,
sortable: true,
dataIndex: 'ISMAB',
field: {
xtype: 'combo',
store: [['1-参与计算MAC','参与计算MAC'],['2-不参与计算MAC','不参与计算MAC']]
}
}
],
dockedItems: [{
xtype: 'toolbar',
items: [{
text: '添加',
iconCls: 'icon-add',
handler: function(){
// empty record
rspstore.insert(0,new Person());
rsprowEditing.startEdit(0, 0);
}
}, '-', {
itemId: 'delete',
text: '删除',
iconCls: 'icon-delete',
disabled: true,
handler: function(){
var selection = reqgrid.getView().getSelectionModel().getSelection()[0];
if (selection) {
rspstore.remove(selection);
}
}
}]
}]
});
reqgrid.getSelectionModel().on('selectionchange', function(selModel, selections){
reqgrid.down('#delete').setDisabled(selections.length === 0);
});
///////////以上应答//////////
/*这个person 就是请求报文 和响应报文的模型 是我自己找的例子 所以名字没有改
*/Ext.define('Person', {
extend: 'Ext.data.Model',
fields: ['NODESEQ','GROUPCODE','NODECODE','META','ISLOOP','ISNULL','COMPMODE','ISENCRYPT','ISMAB'], validations: [{
type: 'length',
field: 'NODESEQ',
min: 1
}, {
type: 'length',
field: 'GROUPCODE',
min: 1
}, {
type: 'length',
field: 'NODECODE',
min: 1
}, {
type: 'length',
field: 'META',
min: 1
}, {
type: 'length',
field: 'ISLOOP',
min: 1
}, {
type: 'length',
field: 'ISNULL',
min: 1
}, {
type: 'length',
field: 'NODECODE',
min: 1
}, {
type: 'length',
field: 'NODECODE',
min: 1
}]
});
Ext.define('succ', {
extend: 'Ext.data.Model',
fields: ['RETGROUPCODE','RETNODECODE','SUCCRETCODE'], validations: [
{
type: 'length',
field: 'RETGROUPCODE',
min: 1
}, {
type: 'length',
field: 'RETNODECODE',
min: 1
}, {
type: 'length',
field: 'SUCCRETCODE',
min: 1
}]
});var store;//请求
var rspstore;//应答
var succstore;//成功
Ext.onReady(function(){
var demoStore = Ext.create('Ext.data.Store', {
// autoLoad: true,//是否自动加载
autoSync: true,//是否自动同步
fields: [
{ name:'METANM' },{ name:'METAID' }
],
proxy : {
type : 'ajax',// 使用ajax请求
url :'get_ESB_META_DATA.do',// 请求后台读取数据的地址
// 读取数据的工具(数据代理)
reader: {
type:'json',
root: 'rows'
}
},
autoLoad: true
});
//英文改成中文
Ext.grid.RowEditor.prototype.saveBtnText = "保存";
Ext.grid.RowEditor.prototype.cancelBtnText = '取消';
/////////////以下请求///////////////////////
store = Ext.create('Ext.data.Store', {
autoLoad: true,//是否自动加载
autoSync: true,//是否自动同步
model: 'Person',//解析数据的模型,模型可以代替proxy和fields配置
data:[]
});
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing');
var grid = Ext.create('Ext.grid.Panel', {
renderTo: 'req',
plugins: [rowEditing],
//width:400,
height: 200,
frame: true,
title: '请求报文',
store: store,
columns: [{ text: '节点顺序号',
flex: 1,
sortable: true,
dataIndex: 'NODESEQ',
field: {
xtype: 'textfield'
}
}, {
header: '节点组代码',
flex: 1,
sortable: true,
dataIndex: 'GROUPCODE',
field: {
xtype: 'textfield'
}
},
{
header: '节点代码',
flex: 1,
sortable: true,
dataIndex: 'NODECODE',
field: {
xtype: 'textfield'
}
}, {
header: '元数据',
flex: 1,
sortable: true,
dataIndex: 'META',
field: {
xtype: 'combo',
store: demoStore,
displayField:"METAID",
valueField:"METANM"
}
},
{
header: '是否循环节点',
flex: 1,
sortable: true,
dataIndex: 'ISLOOP',
field: {
xtype: 'combo',
store: [['1-循环','循环'],['2-不循环','不循环']]
}
},
{
header: '是否可以为空',
flex: 1,
sortable: true,
dataIndex: 'ISNULL',
field: {
xtype: 'combo',
store: [['1-可以为空','可以为空'],['2-不能为空','不能为空']]
}
},
{
header: '补齐方式',
flex: 1,
sortable: true,
dataIndex: 'COMPMODE',
field: {
xtype: 'combo',
store: [['00-不补齐','不补齐'],
['01-左补零','左补零'],
['02-右补零','右补零'],
['03-左补空格','左补空格'],
['04-右补空格','右补空格']
]
}
},
{
header: '是否加密',
flex: 1,
sortable: true,
dataIndex: 'ISENCRYPT',
field: {
xtype: 'combo',
store: [['1-加密','加密'],['2-不加密','不加密']]
}
},
{
header: '是否参与计算MAC',
flex: 1,
sortable: true,
dataIndex: 'ISMAB',
field: {
xtype: 'combo',
store: [['1-参与计算MAC','参与计算MAC'],['2-不参与计算MAC','不参与计算MAC']]
}
}
],
dockedItems: [{
xtype: 'toolbar',
items: [{
text: '添加',
iconCls: 'icon-add',
handler: function(){
// empty record
store.insert(0,new Person());
rowEditing.startEdit(0, 0);
}
}, '-', {
itemId: 'delete',
text: '删除',
iconCls: 'icon-delete',
disabled: true,
handler: function(){
var selection = grid.getView().getSelectionModel().getSelection()[0];
if (selection) {
store.remove(selection);
}
}
}]
}]
});
grid.getSelectionModel().on('selectionchange', function(selModel, selections){
grid.down('#delete').setDisabled(selections.length === 0);
});
///////////以上请求//////////
///////////以下应答//////////
var rsprowEditing = Ext.create('Ext.grid.plugin.RowEditing');
rspstore = Ext.create('Ext.data.Store', {
autoLoad: true,//是否自动加载
autoSync: true,//是否自动同步
model: 'Person',//解析数据的模型,模型可以代替proxy和fields配置
data:[]
});
var reqgrid = Ext.create('Ext.grid.Panel', {
renderTo: 'rsp',
plugins: [rsprowEditing],
//width:400,
height: 200,
frame: true,
title: '应答报文',
store: rspstore,
columns: [{ text: '节点顺序号',
flex: 1,
sortable: true,
dataIndex: 'NODESEQ',
field: {
xtype: 'textfield'
}
}, {
header: '节点组代码',
flex: 1,
sortable: true,
dataIndex: 'GROUPCODE',
field: {
xtype: 'textfield'
}
},
{
header: '节点代码',
flex: 1,
sortable: true,
dataIndex: 'NODECODE',
field: {
xtype: 'textfield'
}
}, {
header: '元数据',
flex: 1,
sortable: true,
dataIndex: 'META',
field: {
xtype: 'combo',
store: demoStore,
displayField:"METAID",
valueField:"METANM"
}
},
{
header: '是否循环节点',
flex: 1,
sortable: true,
dataIndex: 'ISLOOP',
field: {
xtype: 'combo',
store: [['1-循环','循环'],['2-不循环','不循环']]
}
},
{
header: '是否可以为空',
flex: 1,
sortable: true,
dataIndex: 'ISNULL',
field: {
xtype: 'combo',
store: [['1-可以为空','可以为空'],['2-不能为空','不能为空']]
}
},
{
header: '补齐方式',
flex: 1,
sortable: true,
dataIndex: 'COMPMODE',
field: {
xtype: 'combo',
store: [['00-不补齐','不补齐'],
['01-左补零','左补零'],
['02-右补零','右补零'],
['03-左补空格','左补空格'],
['04-右补空格','右补空格']
]
}
},
{
header: '是否加密',
flex: 1,
sortable: true,
dataIndex: 'ISENCRYPT',
field: {
xtype: 'combo',
store: [['1-加密','加密'],['2-不加密','不加密']]
}
},
{
header: '是否参与计算MAC',
flex: 1,
sortable: true,
dataIndex: 'ISMAB',
field: {
xtype: 'combo',
store: [['1-参与计算MAC','参与计算MAC'],['2-不参与计算MAC','不参与计算MAC']]
}
}
],
dockedItems: [{
xtype: 'toolbar',
items: [{
text: '添加',
iconCls: 'icon-add',
handler: function(){
// empty record
rspstore.insert(0,new Person());
rsprowEditing.startEdit(0, 0);
}
}, '-', {
itemId: 'delete',
text: '删除',
iconCls: 'icon-delete',
disabled: true,
handler: function(){
var selection = reqgrid.getView().getSelectionModel().getSelection()[0];
if (selection) {
rspstore.remove(selection);
}
}
}]
}]
});
reqgrid.getSelectionModel().on('selectionchange', function(selModel, selections){
reqgrid.down('#delete').setDisabled(selections.length === 0);
});
///////////以上应答//////////
var succrowEditing = Ext.create('Ext.grid.plugin.RowEditing');
succstore = Ext.create('Ext.data.Store', {
autoLoad: true,//是否自动加载
autoSync: true,//是否自动同步
model: 'succ',//解析数据的模型,模型可以代替proxy和fields配置
data:[]
});
var succgrid = Ext.create('Ext.grid.Panel', {
renderTo: 'succ',
plugins: [succrowEditing],
//width:400,
height: 200,
frame: true,
title: '成功响应码',
store: succstore,
columns: [{
// 'RETGROUPCODE','RETNODECODE','SUCCRETCODE'],
text: '响应码组节点路径',
flex: 1,
sortable: true,
dataIndex: 'RETGROUPCODE',
field: {
xtype: 'textfield'
}
}, {
header: '响应码节点路径',
flex: 1,
sortable: true,
dataIndex: 'RETNODECODE',
field: {
xtype: 'textfield'
}
},
{
header: '成功响应码',
flex: 1,
sortable: true,
dataIndex: 'SUCCRETCODE',
field: {
xtype: 'textfield'
}
}
],
dockedItems: [{
xtype: 'toolbar',
items: [{
text: '添加',
iconCls: 'icon-add',
handler: function(){
// empty record
succstore.insert(0,new succ());
succrowEditing.startEdit(0, 0);
}
}, '-', {
itemId: 'delete',
text: '删除',
iconCls: 'icon-delete',
disabled: true,
handler: function(){
var selection = succgrid.getView().getSelectionModel().getSelection()[0];
if (selection) {
succstore.remove(selection);
}
}
}]
}]
});
succgrid.getSelectionModel().on('selectionchange', function(selModel, selections){
succgrid.down('#delete').setDisabled(selections.length === 0);
});
/////////////////////////////////////////////////////
});
// 'RETGROUPCODE','RETNODECODE','SUCCRETCODE'],
text: '响应码组节点路径',
flex: 1,
sortable: true,
dataIndex: 'RETGROUPCODE',
field: {
xtype: 'textfield'
}
}, {
header: '响应码节点路径',
flex: 1,
sortable: true,
dataIndex: 'RETNODECODE',
field: {
xtype: 'textfield'
}
}/*,
{
header: '成功响应码',
flex: 1,
sortable: true,
dataIndex: 'SUCCRETCODE',
field: {
xtype: 'textfield'
}
}*/
],
其余两个就会正常显示。