forked from bmoeskau/Extensible
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExt-overrides.js
More file actions
107 lines (93 loc) · 3.71 KB
/
Ext-overrides.js
File metadata and controls
107 lines (93 loc) · 3.71 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
Ext.require([
'Ext.picker.Color',
'Ext.form.Basic',
'Ext.data.MemoryProxy'
]);
Extensible.applyOverrides = function() {
Ext.DomHelper = Ext.core.DomHelper;
Ext.picker.Color.override({
constructor: function() {
// use an existing renderTpl if specified
this.renderTpl = this.renderTpl || Ext.create('Ext.XTemplate', '<tpl for="colors"><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on"> </span></em></a></tpl>');
this.callParent(arguments);
}
});
// This was fixed in Ext 4.0.5:
Ext.layout.container.AbstractCard.override({
renderChildren: function () {
// added check to honor deferredRender when rendering children
if (!this.deferredRender) {
this.getActiveItem();
this.callParent();
}
}
});
Ext.data.reader.Reader.override({
extractData : function(root) {
var me = this,
values = [],
records = [],
Model = me.model,
i = 0,
length = root.length,
idProp = me.getIdProperty(),
node, id, record;
if (!root.length && Ext.isObject(root)) {
root = [root];
length = 1;
}
for (; i < length; i++) {
node = root[i];
values = me.extractValues(node);
// Assuming that the idProperty is intended to use the id mapping, if
// available, getId() should read from the mapped values not the raw values.
// Using the non-mapped id causes updates later to silently fail since
// the updated data is replaced by id.
//id = me.getId(node);
id = me.getId(values);
record = new Model(values, id, node);
records.push(record);
if (me.implicitIncludes) {
me.readAssociated(record, node);
}
}
return records;
}
});
Ext.form.Basic.override({
reset: function() {
var me = this;
// This causes field events to be ignored. This is a problem for the
// DateTimeField since it relies on handling the all-day checkbox state
// changes to refresh its layout. In general, this batching is really not
// needed -- it was an artifact of pre-4.0 performance issues and can be removed.
//me.batchLayouts(function() {
me.getFields().each(function(f) {
f.reset();
});
//});
return me;
}
});
// Currently MemoryProxy really only functions for read-only data. Since we want
// to simulate CRUD transactions we have to at the very least allow them to be
// marked as completed and successful, otherwise they will never filter back to the
// UI components correctly.
Ext.data.MemoryProxy.override({
updateOperation: function(operation, callback, scope) {
operation.setCompleted();
operation.setSuccessful();
Ext.callback(callback, scope || me, [operation]);
},
create: function() {
this.updateOperation.apply(this, arguments);
},
update: function() {
this.updateOperation.apply(this, arguments);
},
destroy: function() {
this.updateOperation.apply(this, arguments);
}
});
};
Ext.onReady(Extensible.applyOverrides);