qq_34052254 2017-02-07 06:21 采纳率: 25%
浏览 1595
已结题

EXTJS表单中的data如何从后台获取值,在表单中展示

我是刚入职的初级程序员,公司现在在做的项目是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数据库中读取应该怎么做

  • 写回答

3条回答 默认 最新

  • qq_36498920 2017-02-07 07:07
    关注

    用ajax,利用json对象传值

    评论

报告相同问题?

悬赏问题

  • ¥15 有卷积神经网络识别害虫的项目吗
  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件