-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdhx.ui.crud.simple.View.Record.js
executable file
·100 lines (86 loc) · 3.53 KB
/
dhx.ui.crud.simple.View.Record.js
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
/*jslint browser: true, devel: true, eqeq: true, newcap: true, nomen: true, white: true */
/*global $dhx, dhtmlx, dhtmlXLayoutObject */
$dhx.ui.crud.simple.View.Record = {
wrapper: [],
strTabID: "$dhx.ui.crud.simple.View.Record.tab.",
form: [],
layout: []
,
formTemplates: []
,
_layout: function(uid) {
var self = $dhx.ui.crud.simple.View.Record;
self.layout[uid] = self.wrapper[uid].attachLayout($dhx.ui.crud.simple.View.settings.layout);
self.layout[uid].cells('a').hideHeader();
}
,
_form: function(uid) {
var self = $dhx.ui.crud.simple.View.Record;
self.form[uid] = self.layout[uid].cells('a').attachForm(self.formTemplates[uid].template);
self.form[uid].attachEvent("onButtonClick", function(name) {
});
}
,
render: function(configuration, schema) {
var self = $dhx.ui.crud.simple.View.Record;
console.log(configuration)
configuration = configuration || {};
var uid = configuration.record_id;
var tabId = self.strTabID + uid;
if (typeof self.wrapper[uid] !== 'undefined') {
if (self.wrapper[uid].tabbar != null) {
//console.log(self.wrapper[ uid ]);
configuration.wrapper.cells(uid).setActive();
return;
}
}
console.log(schema);
console.log(schema);
console.log(schema);
console.log(schema);
console.log(schema);
schema.getRecord(uid, function(record, recordRequest, event) {
configuration.wrapper.addTab(uid, uid, null, null, true, true);
self.wrapper[uid] = configuration.wrapper.cells(uid);
self.formTemplates[uid] = {
"template": [{
type: "settings",
position: "label-left",
labelWidth: 160,
inputWidth: (configuration.is_generic) ?
($dhx.ui.crud.simple.View.settings.app_generic.window.width - 160 - 170) : ($dhx.windowWidth - 300),
inputHeight: 30,
labelHeight: 30
}, {
type: 'block',
inputWidth: 'auto',
inputHeight: 30,
labelHeight: 30,
list: []
}]
}
//$dhx.ui.crud.simple.View.settings.app_generic.window.height
//$dhx.ui.crud.simple.View.settings.app_generic.window.width
$dhx.dataDriver.dbs[configuration.db].settings[configuration.table].form.template.forEach(function(field, index_, array_) {
var ffield = {}
ffield.type = 'template';
ffield.name = field.name;
ffield.label = field.label;
ffield.value = record[field.name];
ffield.format = function(name, value) {
// to access form instance from format function
// you cann use the following method:
// var form = this.getForm();
return "<div class='record_text'>" + value + "</div>";
};
self.formTemplates[uid].template[1].list.push(ffield);
});
$dhx.showDirections("starting view ... ");
self._layout(uid);
self._form(uid);
if (configuration.fnCallBack) configuration.fnCallBack();
$dhx.hideDirections();
}, function(recordRequest, event, error_message) {
});
}
};