jqgrid_utils 1.5.6 → 1.7.0

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#add_textarea(col_model, edit_field)](#exp_module_Jqgrid_utils--module.exports+add_textarea) ⏏
30
31
  * [module.exports#get_col_model_from_data(obj, data, exclude, col_model)](#exp_module_Jqgrid_utils--module.exports+get_col_model_from_data) ⇒ <code>array</code> ⏏
31
32
  * [module.exports#_date112_to_DMY(cell_value, seperator)](#exp_module_Jqgrid_utils--module.exports+_date112_to_DMY) ⏏
32
33
  * [module.exports#date112_to_DMY(col_model, edit_field, seperator)](#exp_module_Jqgrid_utils--module.exports+date112_to_DMY) ⏏
@@ -59,6 +60,24 @@ A module for Jqgrid_utils
59
60
  * [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
60
61
  * [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
61
62
 
63
+ <a name="exp_module_Jqgrid_utils--module.exports+add_textarea"></a>
64
+
65
+ ### module.exports#add\_textarea(col_model, edit_field) ⏏
66
+ add textarea
67
+
68
+ **Kind**: Exported function
69
+
70
+ | Param | Type | Description |
71
+ | --- | --- | --- |
72
+ | col_model | <code>string</code> | edit_filed |
73
+ | edit_field | <code>string</code> | style of the textaread |
74
+
75
+ **Example**
76
+ ```js
77
+ var jqu = new Jqgrid_utils();
78
+ let _data = jqu._date112_to_DMY('20220104','/');
79
+ console.log(_data);
80
+ ```
62
81
  <a name="exp_module_Jqgrid_utils--module.exports+get_col_model_from_data"></a>
63
82
 
64
83
  ### module.exports#get\_col\_model\_from\_data(obj, data, exclude, col_model) ⇒ <code>array</code> ⏏
@@ -22,6 +22,35 @@ module.exports = class Vanilla_website_utils
22
22
 
23
23
  }
24
24
 
25
+
26
+
27
+ /**
28
+ * add textarea
29
+ @alias module:Jqgrid_utils
30
+ @param {string} - edit_filed
31
+ @param {string} - style of the textaread
32
+ @example
33
+ var jqu = new Jqgrid_utils();
34
+ let _data = jqu._date112_to_DMY('20220104','/');
35
+ console.log(_data);
36
+ */
37
+ async add_textarea(col_model, edit_field, style = 'style="width:100%;height:450px"')
38
+ {
39
+ let f = window.sqlFormatter;
40
+ for (let i = 0; i < col_model.length; i++)
41
+ {
42
+ if (col_model[i]['name'] === edit_field)
43
+ {
44
+ col_model[i]['formatter'] = function(cell_val)
45
+ {
46
+ let sql = '<textarea '+ style +'>' + cell_val + '</textarea>' ;
47
+ return sql;
48
+ };
49
+ }
50
+ }
51
+ return col_model;
52
+ }
53
+
25
54
  /**
26
55
  * Get basic colModel data from raw data
27
56
  @alias module:Jqgrid_utils
@@ -72,7 +101,32 @@ var jqu = new Jqgrid_utils();
72
101
  return col_model;
73
102
  }
74
103
 
104
+ /**
105
+ * Replace a Binaery 0 or 1 to other given value
106
+ @alias module:Jqgrid_utils
107
+ @param {string} - cell value
108
+ @param {string} - string replacement for 0
109
+ @param {string} - string replacement for 1
110
+ @example
111
+ var jqu = new Jqgrid_utils();
112
+ let _data = jqu.binery_replace(0,'zero','one');
113
+ or for column formatter
114
+ download_formatter:"var jqu = new Jqgrid_utils();jqu.binary_replace({0},'zero','one')"});
115
+ */
116
+ binary_replace(cell_value, a='zero',b='one')
117
+ {
118
+ let value = a;
119
+ if(cell_value == 1 || cell_value == 0 )
120
+ {
121
+ if(cell_value == 1)
122
+ {
123
+ value = b;
124
+ }
125
+ }
126
+ return value;
127
+ }
75
128
 
129
+
76
130
  /**
77
131
  * Convert a 112 date string to a DMY format with sepertaor - sync function
78
132
  @alias module:Jqgrid_utils
package/jqgrid_utils.js CHANGED
@@ -21,6 +21,35 @@ module.exports = class Vanilla_website_utils
21
21
 
22
22
  }
23
23
 
24
+
25
+
26
+ /**
27
+ * add textarea
28
+ @alias module:Jqgrid_utils
29
+ @param {string} - edit_filed
30
+ @param {string} - style of the textaread
31
+ @example
32
+ var jqu = new Jqgrid_utils();
33
+ let _data = jqu._date112_to_DMY('20220104','/');
34
+ console.log(_data);
35
+ */
36
+ async add_textarea(col_model, edit_field, style = 'style="width:100%;height:450px"')
37
+ {
38
+ let f = window.sqlFormatter;
39
+ for (let i = 0; i < col_model.length; i++)
40
+ {
41
+ if (col_model[i]['name'] === edit_field)
42
+ {
43
+ col_model[i]['formatter'] = function(cell_val)
44
+ {
45
+ let sql = '<textarea '+ style +'>' + cell_val + '</textarea>' ;
46
+ return sql;
47
+ };
48
+ }
49
+ }
50
+ return col_model;
51
+ }
52
+
24
53
  /**
25
54
  * Get basic colModel data from raw data
26
55
  @alias module:Jqgrid_utils
@@ -71,7 +100,32 @@ var jqu = new Jqgrid_utils();
71
100
  return col_model;
72
101
  }
73
102
 
103
+ /**
104
+ * Replace a Binaery 0 or 1 to other given value
105
+ @alias module:Jqgrid_utils
106
+ @param {string} - cell value
107
+ @param {string} - string replacement for 0
108
+ @param {string} - string replacement for 1
109
+ @example
110
+ var jqu = new Jqgrid_utils();
111
+ let _data = jqu.binery_replace(0,'zero','one');
112
+ or for column formatter
113
+ download_formatter:"var jqu = new Jqgrid_utils();jqu.binary_replace({0},'zero','one')"});
114
+ */
115
+ binary_replace(cell_value, a='zero',b='one')
116
+ {
117
+ let value = a;
118
+ if(cell_value == 1 || cell_value == 0 )
119
+ {
120
+ if(cell_value == 1)
121
+ {
122
+ value = b;
123
+ }
124
+ }
125
+ return value;
126
+ }
74
127
 
128
+
75
129
  /**
76
130
  * Convert a 112 date string to a DMY format with sepertaor - sync function
77
131
  @alias module:Jqgrid_utils
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.5.6"
32
+ "version": "1.7.0"
33
33
  }