PluginProbe
Smart Forms – when you need more than just a contact form / 0.5
Smart Forms – when you need more than just a contact form v0.5
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / js / formBuilder / formanalytics.js

formanalytics.js in Smart Forms – when you need more than just a contact form 0.5, at js/formBuilder/formanalytics.js

117 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function RedNaoCreateColumn(options)
2 {
3 var elementName=options.ClassName;
4
5 if(elementName=='rednaotextinput')
6 return RedNaoTextInputColumn(options);
7 if(elementName=='rednaoprependedtext')
8 return RedNaoTextInputColumn(options);
9 if(elementName=='rednaoappendedtext')
10 return RedNaoTextInputColumn(options);
11 if(elementName=='rednaoprependedcheckbox')
12 return RedNaoCheckboxInputColumn(options);
13 if(elementName=='rednaoappendedcheckbox')
14 return RedNaoCheckboxInputColumn(options);
15
16
17 if(elementName=='rednaomultiplecheckboxes')
18 return RedNaoMultipleCheckBoxesColumn(options);
19 if(elementName=='rednaoselectbasic')
20 return RedNaoTextInputColumn(options);
21
22 if(elementName=='rednaotextarea')
23 return RedNaoTextInputColumn(options);
24 if(elementName=='rednaomultipleradios')
25 return RedNaoTextInputColumn(options);
26 if(elementName=='rednaodatepicker')
27 return RedNaoDatePicker(options);
28
29
30 }
31
32 function GetObjectOrNull(rowObject,options)
33 {
34 var object=rowObject[options.colModel.index];
35 if(typeof object=='undefined')
36 return null;
37
38 return object;
39
40 }
41
42
43 function RedNaoTextInputColumn(options)
44 {
45 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
46 {
47 try{
48 var data=GetObjectOrNull(rowObject,cellOptions);
49 if(data==null)
50 return '';
51 return data.value;
52 }catch(exception)
53 {
54 return '';
55 }
56 }};
57 }
58
59
60 function RedNaoCheckboxInputColumn(options)
61 {
62 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
63 {
64 try{
65 var data=GetObjectOrNull(rowObject,cellOptions);
66 if(data==null)
67 return '';
68 return data.checked+". "+data.value;
69 }catch(exception)
70 {
71 return '';
72 }
73 }};
74 }
75
76 function RedNaoMultipleCheckBoxesColumn(options)
77 {
78 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
79 {
80 try{
81 var data=GetObjectOrNull(rowObject,cellOptions);
82 if(data==null)
83 return '';
84 var values="";
85
86 for(var i=0;i<data.selectedValues.length;i++)
87 values+=data.selectedValues[i].value.trim()+";";
88 return values;
89 }catch(exception)
90 {
91 return '';
92 }
93 }};
94 }
95
96 function RedNaoDatePicker(options)
97 {
98 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
99 {
100 try{
101 var data=GetObjectOrNull(rowObject,cellOptions);
102 if(data==null||data.value=="")
103 return '';
104 var dateParts=data.value.split("-");
105 if(dateParts.length!=3)
106 return '';
107
108 var date=new Date(dateParts[0],parseInt(dateParts[1])-1,dateParts[2]);
109
110 return rnJQuery.datepicker.formatDate( options.DateFormat, date );
111 }catch(exception)
112 {
113 return '';
114 }
115 }};
116 }
117