-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormDesigner.js
69 lines (51 loc) · 2.76 KB
/
FormDesigner.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
Type.registerNamespace("SitefinityWebApp");
SitefinityWebApp.FormDesigner = function (element) {
/* Initialize MyLabel fields */
this._myLabel = null;
/* Initialize MyCheckbox fields */
this._myCheckbox = null;
/* Calls the base constructor */
SitefinityWebApp.FormDesigner.initializeBase(this, [element]);
}
SitefinityWebApp.FormDesigner.prototype = {
/* --------------------------------- set up and tear down --------------------------------- */
initialize: function () {
/* Here you can attach to events or do other initialization */
SitefinityWebApp.FormDesigner.callBaseMethod(this, 'initialize');
},
dispose: function () {
/* this is the place to unbind/dispose the event handlers created in the initialize method */
SitefinityWebApp.FormDesigner.callBaseMethod(this, 'dispose');
},
/* --------------------------------- public methods ---------------------------------- */
findElement: function (id) {
var result = jQuery(this.get_element()).find("#" + id).get(0);
return result;
},
/* Called when the designer window gets opened and here is place to "bind" your designer to the control properties */
refreshUI: function () {
var controlData = this._propertyEditor.get_control(); /* JavaScript clone of your control - all the control properties will be properties of the controlData too */
/* RefreshUI MyLabel */
jQuery(this.get_myLabel()).val(controlData.MyLabel);
/* RefreshUI MyCheckbox */
jQuery(this.get_myCheckbox()).attr("checked", controlData.MyCheckbox);
},
/* Called when the "Save" button is clicked. Here you can transfer the settings from the designer to the control */
applyChanges: function () {
var controlData = this._propertyEditor.get_control();
/* ApplyChanges MyLabel */
controlData.MyLabel = jQuery(this.get_myLabel()).val();
/* ApplyChanges MyCheckbox */
controlData.MyCheckbox = jQuery(this.get_myCheckbox()).is(":checked");
},
/* --------------------------------- event handlers ---------------------------------- */
/* --------------------------------- private methods --------------------------------- */
/* --------------------------------- properties -------------------------------------- */
/* MyLabel properties */
get_myLabel: function () { return this._myLabel; },
set_myLabel: function (value) { this._myLabel = value; },
/* MyCheckbox properties */
get_myCheckbox: function () { return this._myCheckbox; },
set_myCheckbox: function (value) { this._myCheckbox = value; }
}
SitefinityWebApp.FormDesigner.registerClass('SitefinityWebApp.FormDesigner', Telerik.Sitefinity.Web.UI.ControlDesign.ControlDesignerBase);