This repository has been archived by the owner on Mar 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
79 lines (66 loc) · 2.44 KB
/
test.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
// The file has been created, saved into "/Style Library/"
// and attached to the LFWP via JSLink property.
SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function() {
function getBaseHtml(ctx) {
return SPClientTemplates["_defaultTemplates"].Fields.default.all.all[ctx.CurrentFieldSchema.FieldType][ctx.BaseViewID](ctx);
}
function init() {
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
//form wrapper
OnPreRender: form,
Templates: {
Fields: {
"calendar": {
EditForm: picker,
NewForm: picker
},
"boolean": {
EditForm: picker,
NewForm: picker
},
"lookup": {
EditForm: function(ctx){
var params = {
templateResult: function (item) {
var $item = $('<span style="text-decoration:underline">'+item.id+'</span> ' + '<span style="font-weight: bold">'+item.text+'</span>');;
return $item;
}
};
return picker(ctx, params);
},
NewForm: picker
},
"multilookup": {
EditForm: picker,
NewForm: picker
},
"multichoice": {
EditForm: picker,
NewForm: picker
},
"choice": {
EditForm: picker,
NewForm: picker
}
}
},
//field wrapper
OnPostRender: field,
ListTemplateType: 100
});
}
//This is form wrapper
var form = function (ctx) {
spBsCtrls.formWrap(ctx);
}
//This is field wrapper
var field = function (ctx) {
spBsCtrls.fieldWrap(ctx);
}
//This is picker to choose controls
var picker = function (ctx, params) {
return spBsCtrls.picker(ctx, params);
}
RegisterModuleInit(SPClientTemplates.Utility.ReplaceUrlTokens("~siteCollection/Style Library/supertest.js"), init);
init();
});