jqgrid_utils 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,6 +27,7 @@ A module for Jqgrid_utils
27
27
 
28
28
 
29
29
  * [Jqgrid_utils](#module_Jqgrid_utils)
30
+ * [module.exports#format_date112(col_model, edit_field, seperator)](#exp_module_Jqgrid_utils--module.exports+format_date112) ⏏
30
31
  * [module.exports#add_ok_button(col_model, fields)](#exp_module_Jqgrid_utils--module.exports+add_ok_button) ⇒ <code>array</code> ⏏
31
32
  * [module.exports#get_filled_cell_table_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data) ⇒ <code>array</code> ⏏
32
33
  * [module.exports#get_filled_cell_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
@@ -55,6 +56,25 @@ A module for Jqgrid_utils
55
56
  * [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
56
57
  * [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
57
58
 
59
+ <a name="exp_module_Jqgrid_utils--module.exports+format_date112"></a>
60
+
61
+ ### module.exports#format\_date112(col_model, edit_field, seperator) ⏏
62
+ Convert a 112 date to a DMY format with sepertaor
63
+
64
+ **Kind**: Exported function
65
+
66
+ | Param | Type | Default | Description |
67
+ | --- | --- | --- | --- |
68
+ | col_model | <code>object</code> | | col_model of the grid |
69
+ | edit_field | <code>string</code> | | name of the date 112 column what should get converted |
70
+ | seperator | <code>string</code> | <code>&quot;/&quot;</code> | seperator used |
71
+
72
+ **Example**
73
+ ```js
74
+ var jqu = new Jqgrid_utils();
75
+ let _data = await jqu.date_format(this,'field','/');
76
+ console.log(_data);
77
+ ```
58
78
  <a name="exp_module_Jqgrid_utils--module.exports+add_ok_button"></a>
59
79
 
60
80
  ### module.exports#add\_ok\_button(col_model, fields) ⇒ <code>array</code> ⏏
@@ -22,7 +22,40 @@ module.exports = class Vanilla_website_utils
22
22
 
23
23
  }
24
24
 
25
-
25
+ /**
26
+ * Convert a 112 date to a DMY format with sepertaor
27
+ @alias module:Jqgrid_utils
28
+ @param {object} - col_model of the grid
29
+ @param {string} - name of the date 112 column what should get converted
30
+ @param {string} - seperator used
31
+ @example
32
+ var jqu = new Jqgrid_utils();
33
+ let _data = await jqu.date_format(this,'field','/');
34
+ console.log(_data);
35
+ */
36
+ async format_date112(col_model, edit_field , seperator='/')
37
+ {
38
+ for(let i=0;i< col_model.length;i++)
39
+ {
40
+ if(col_model[i]['name'] === edit_field)
41
+ {
42
+ col_model[i]['formatter'] = function (cell_value, o)
43
+ {
44
+ let value = cell_value;
45
+ if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
46
+ {
47
+ let a = [];
48
+ a.push(cell_value.substr(6, 2));
49
+ a.push(cell_value.substr(4, 2));
50
+ a.push(cell_value.substr(0, 4));
51
+ value = a.join(seperator);
52
+ }
53
+ return value;
54
+ };
55
+ }
56
+ }
57
+ return col_model;
58
+ }
26
59
 
27
60
 
28
61
  /**
package/jqgrid_utils.js CHANGED
@@ -21,7 +21,40 @@ module.exports = class Vanilla_website_utils
21
21
 
22
22
  }
23
23
 
24
-
24
+ /**
25
+ * Convert a 112 date to a DMY format with sepertaor
26
+ @alias module:Jqgrid_utils
27
+ @param {object} - col_model of the grid
28
+ @param {string} - name of the date 112 column what should get converted
29
+ @param {string} - seperator used
30
+ @example
31
+ var jqu = new Jqgrid_utils();
32
+ let _data = await jqu.date_format(this,'field','/');
33
+ console.log(_data);
34
+ */
35
+ async format_date112(col_model, edit_field , seperator='/')
36
+ {
37
+ for(let i=0;i< col_model.length;i++)
38
+ {
39
+ if(col_model[i]['name'] === edit_field)
40
+ {
41
+ col_model[i]['formatter'] = function (cell_value, o)
42
+ {
43
+ let value = cell_value;
44
+ if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
45
+ {
46
+ let a = [];
47
+ a.push(cell_value.substr(6, 2));
48
+ a.push(cell_value.substr(4, 2));
49
+ a.push(cell_value.substr(0, 4));
50
+ value = a.join(seperator);
51
+ }
52
+ return value;
53
+ };
54
+ }
55
+ }
56
+ return col_model;
57
+ }
25
58
 
26
59
 
27
60
  /**
package/package.json CHANGED
@@ -29,5 +29,5 @@
29
29
  {
30
30
  "test": "echo \"Error: no test specified\" && exit 1"
31
31
  },
32
- "version": "1.4.5"
32
+ "version": "1.4.6"
33
33
  }