我是刚入职的初级程序员,公司现在在做的项目是SPRINGMVC+EXTJS。数据库oracle
。
之前一直没学过EXTJS。因为项目快验收了,网上的资料很杂,不得已来求大家帮忙。
doDoubleClick() {
//复制一份data用以cancel时使用,jquery数组深拷贝
var oldData = $.map(this.data, function (obj) {
return $.extend(true, {}, obj);//返回对象的深拷贝
});
var gridStore = new Ext.create("Ext.data.Store", {
reader: new Ext.data.ArrayReader(
{
idIndex: 'id'
},
[
{ name: 'ID' },
{ name: 'Name' },
{ name: 'Value' }
]
),
sortInfo: { field: 'ID', direction: 'ASC' },
// fields: ["ID", "Name", "Value"],
data: this.data
});
var grid = new Ext.create('Ext.grid.Panel', {
title: '元件属性列表',
store: gridStore,
columns: [
{ header: 'ID', dataIndex: 'ID' , },
{
header: 'Name', dataIndex: 'Name', flex: 1,
field: {
// xtype: 'textfield',
allowBlank: false
}
},
{ header: 'Value', dataIndex: 'Value', field: 'textfield' }
],
selType: 'cellmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
//height: 200,
//width: 400,
//renderTo: Ext.getBody()
});
var win = new Ext.Window({
width: 500,
height: 400,
closable: true,
title: "元件属性编辑器",
layout: 'fit',//布局方式
maximizable: true,//显示最大化按钮,点击最大化按钮,窗口自动扩展充满整个浏览器,并且窗口右上角的最大化按钮变为回复原状的按钮
minimizable: true,//显示最小化按钮,并未对这个按钮做任何处理,可以添加监听事件minimizable或重写minimizable()函数
closeAction: 'hide',
constrainHeader: true,//设置窗口的顶部不会超出浏览器边界
//constrain:true,//设置整个窗口都不回超出浏览器边界
defaultButton: 0,//默认选中的按钮
resizable: true,//控制窗口是否可以通过拖拽改变大小
resizeHandles: 'se',//控制拖拽方式,必须是在设置了resizable的情况下,
modal: true,//弹出窗口后立刻屏蔽掉其他的组件,只有关闭窗口后才能操作其他组件,
plain: true,//对窗口内部内容惊醒美化,可以看到整齐的边框
animateTarget: 'target',//可以使窗口展示弹并缩回效果的动画
items: grid,
buttons: [
{
text: 'Save',
type: 'submit',
handler: function()
{
}
// win.removeAll();
// win.close();
}, {
text: 'Cancel',
handler: function () {
this.data = oldData
win.close();
}
}
]
});
gridStore.load();
win.show();
return
}
上面这个是父类中的双击事件
class OneNodeElement extends Element {
constructor(node, pos, core, line, svgLayer, id) {
let nodes = new Array(null, null, null);
let data = [
{ "ID": 1, "Name": "ID", "Value": id },
{ "ID": 2, "Name": "Pressure", "Value": "10" },
{ "ID": 3, "Name": "Q", "Value": "20000" },
{ "ID": 4, "Name": "Temperature", "Value": "60" },
{ "ID": 5, "Name": "Reliability", "Value": "95" }
];
nodes[pos] = node;
core.setAidGrahpicArg(-11, -13, 26, 26);
super(nodes, core, line, svgLayer, id, data);
this.node = node;
this.pos = pos;
}
}
上面这个是子类中的写死的data。
现在我想把DATA中的数据改成从ORACLE数据库中读取应该怎么做