DefaultValuesWindow.js
2.51 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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() {
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){
if(defaults['success'])
amdaDefaultValues=defaults['defaultValues'];
});
me.defaultValuesGrid.removeAll();
me.defaultValuesGrid.destroy();
me.close();
}
});
}
},
},
{
// To quit the window
text: 'Cancel',
handler: function() {
me.defaultValuesGrid.removeAll();
me.defaultValuesGrid.destroy();
me.close();
}
}]
}
]
});
}
});