Blame view

js/app/views/DefaultValuesWindow.js 2.51 KB
851cf2f0   Erdogan Furkan   For now
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43


Ext.define('amdaUI.DefaultValuesWindow',{
    extend: 'Ext.window.Window',
    alias: 'widget.defaultvalueswindow',

    requires:[
        'amdaUI.DefaultTreeGrid',
    ],
    defaultValuesGrid: null,
    constructor:function(){
        this.defaultValuesGrid = Ext.create('amdaUI.DefaultTreeGrid');
        this.init();
		this.callParent();
    },

    init:function(config){

        var me=this;
        Ext.apply(this,  {
            title: 'Default Values Grid',
            width: 350,
            height: 380,
            closable:false,
            modal:true,
            resizable: false,
            items: [
                {
                    xtype: 'form',
                    renderTo: Ext.getBody(),
                    layout:'hbox',
                    frame: false,
                    items: [
                    {
                        flex:1,
                        items:[me.defaultValuesGrid],
                    },
                ],

                    buttons: [{
                        text: 'Save',
                        handler: function() {

239d9f8f   Erdogan Furkan   First Working ver...
44
45
46
47
48
49
                            me.defaultValuesGrid.modifiedDefaults = {};
                            me.defaultValuesGrid.extractData();
                            if (Object.keys(me.defaultValuesGrid.modifiedDefaults).length >= 1){
                                AmdaAction.setUserDefaultValues(me.defaultValuesGrid.modifiedDefaults, function(res) {
                                    if(res['success']){
                                        AmdaAction.getDefaultValueTree(false, function(defaults){
b1dc2eb3   Erdogan Furkan   More modifications
50
51
                                            if(defaults['success'])
                                                amdaDefaultValues=defaults['defaultValues'];
239d9f8f   Erdogan Furkan   First Working ver...
52
53
54
55
56
57
58
                                        });
                                        me.defaultValuesGrid.removeAll();
                                        me.defaultValuesGrid.destroy();
                                        me.close();
                                    }
                                });
                            }
851cf2f0   Erdogan Furkan   For now
59
60
61
                        },
                    },
                    {
851cf2f0   Erdogan Furkan   For now
62
63
64
                        // To quit the window
                        text: 'Cancel',
                        handler: function() {
239d9f8f   Erdogan Furkan   First Working ver...
65
66
                            me.defaultValuesGrid.removeAll();
                            me.defaultValuesGrid.destroy();
851cf2f0   Erdogan Furkan   For now
67
68
69
70
71
72
73
74
                            me.close();
                        }
                    }]
                }
            ]
        });
    }
});