grdGSMNotification.js
6.41 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
//Ext.Loader.setPath('Ext.ux', 'extjs-4.2/examples/ux');
Ext.define('App.view.grdGSMNotification', {
extend: 'Ext.grid.Panel',
alias: 'widget.grdgsmnotification',
requires: [
'Ext.data.*',
'Ext.grid.*',
'Ext.util.*',
'Ext.toolbar.Paging'
],
frame: true,
initComponent: function () {
this.cellEditing = new Ext.grid.plugin.CellEditing({
clicksToEdit: 2
});
Ext.apply(this, {
store: 'RegionStore',
plugins: [this.cellEditing],
columns: [
{
header: 'Район ',
dataIndex: 'title',
width: 200
},
{
xtype: 'actioncolumn',
width: 60,
height:32,
dataIndex: 'id',
items: [{
icon: 'content/xml.png',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
// alert("Edit ID " + rec.get('id'));
if (!winUpLoad) {
var winUpLoad = Ext.create('App.view.winUpLoad');
winUpLoad.show();
}
// Ext.getCmp("wintitle").html(rec.get('title'));
Ext.getCmp('wintitle').update("<div style=' font-size:14pt; padding:4px'>"+rec.get('title')+"</div>");
Ext.getCmp('winid').update(rec.get('id'));
}
}
],
action: 'upload'
},
{
xtype: 'actioncolumn',
width: 60,
height: 32,
dataIndex: 'id',
items: [{
icon: 'content/list.png',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
if (!winListGSM) {
var winListGSM = Ext.create('App.view.winListGSM');
Ext.getCmp('grdPersonGSM').getStore().removeAll();
Ext.getCmp('grdStationGSM').getStore().removeAll();
Ext.getCmp('grdContactGSM').getStore().removeAll();
winListGSM.show();
}
sParams = 'id=' + rec.get('id');
Ext.Ajax.request({
url: '/GSMNotification/GetList',
type: "POST",
params: sParams,
success: function (response, options) {
objAjax = Ext.decode(response.responseText); // декодируем полученные json-объекты
for (var i = 0; i < objAjax.data.length; i++) {
var id = objAjax.data[i].id;
var job = objAjax.data[i].job;
var name = objAjax.data[i].name;
var organization = objAjax.data[i].organization;
Ext.getCmp('grdPersonGSM').getStore().insert(
0,
new App.model.PersonGSM({
id: id,
job: job,
name: name,
organization: organization
})
);
}
},
failure: function (response, options) {
}
});
}
}
],
action: 'list'
}
]
});
this.callParent();
}
});
/*
var data = '{"name": "mkyong","age": 30,"address": {"streetAddress": "88 8nd Street","city": "New York"},"phoneNumber": [{"type": "home","number": "111 111-1111"},{"type": "fax","number": "222 222-2222"}]}';
var json = JSON.parse(data);
alert(json["name"]); //mkyong
alert(json.name); //mkyong
alert(json.address.streetAddress); //88 8nd Street
alert(json["address"].city); //New York
alert(json.phoneNumber[0].number); //111 111-1111
alert(json.phoneNumber[1].type); //fax
alert(json.phoneNumber.number); //undefined
*/