jqgrid_utils 1.3.9 → 1.4.2

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
@@ -8,11 +8,9 @@ Demo:
8
8
 
9
9
  Add a the library to your website
10
10
 
11
- ``
12
- `html
11
+ ```html
13
12
  <script src="../node_modules/jqgrid_utils/dist/jqgrid_utils.js"></script>
14
- `
15
- ``
13
+ ```
16
14
 
17
15
 
18
16
  Example Usage:
@@ -23,6 +23,44 @@ module.exports = class Vanilla_website_utils
23
23
  }
24
24
 
25
25
 
26
+
27
+
28
+ /**
29
+ * Add an OK Button
30
+ @alias module:Jqgrid_utils
31
+ @param {array} - grid col_model
32
+ @param {array} - list of columns names what will be converted to ok buttons
33
+ @returns {array} - col_model
34
+ @example
35
+ var jqu = new Jqgrid_utils();
36
+ col_model = await jqu.add_ok_button(col_model, ['checked']);
37
+ */
38
+
39
+ async add_ok_button(col_model, fields)
40
+ {
41
+ let self = this;
42
+ for (let i = 0; i < col_model.length; i++)
43
+ {
44
+ if (fields.indexOf(col_model[i]['name']) > -1)
45
+ {
46
+ col_model[i]['formatter'] = function(cell_val)
47
+ {
48
+ if (cell_val != undefined)
49
+ {
50
+ return self.__cell_format(cell_val, 'format_ok');
51
+ }
52
+ else
53
+ {
54
+ return '';
55
+ }
56
+ };
57
+ }
58
+ }
59
+ return col_model;
60
+ }
61
+
62
+
63
+
26
64
  /**
27
65
  * Get the filled cell data
28
66
  @alias module:Jqgrid_utils
@@ -33,7 +71,6 @@ module.exports = class Vanilla_website_utils
33
71
  var jqu = new Jqgrid_utils();
34
72
  col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
35
73
  */
36
-
37
74
  async get_filled_cell_table_data(_grid, fields=[])
38
75
  {
39
76
  let d = jQuery(_grid).jqGrid('getGridParam','data');
@@ -137,11 +174,11 @@ console.log(_data);
137
174
 
138
175
  /**
139
176
  * Hide a col_model column before load the grid
140
- @alias module:Jqgrid_utils
141
- @param {object} - col_model of the grid
142
- @param {string} - name of the column to hide
143
- @returns {object} col_model
144
- @example
177
+ * @alias module:Jqgrid_utils
178
+ * @param {object} - col_model of the grid
179
+ * @param {string} - name of the column to hide
180
+ * @returns {object} col_model
181
+ * @example
145
182
  if(filter['_filter'] == 'ch_p_higher_ch_plus_10pc')
146
183
  {
147
184
  col_model = await jqu.hide_column(col_model,'wholesale');
package/jqgrid_utils.js CHANGED
@@ -22,6 +22,44 @@ module.exports = class Vanilla_website_utils
22
22
  }
23
23
 
24
24
 
25
+
26
+
27
+ /**
28
+ * Add an OK Button
29
+ @alias module:Jqgrid_utils
30
+ @param {array} - grid col_model
31
+ @param {array} - list of columns names what will be converted to ok buttons
32
+ @returns {array} - col_model
33
+ @example
34
+ var jqu = new Jqgrid_utils();
35
+ col_model = await jqu.add_ok_button(col_model, ['checked']);
36
+ */
37
+
38
+ async add_ok_button(col_model, fields)
39
+ {
40
+ let self = this;
41
+ for (let i = 0; i < col_model.length; i++)
42
+ {
43
+ if (fields.indexOf(col_model[i]['name']) > -1)
44
+ {
45
+ col_model[i]['formatter'] = function(cell_val)
46
+ {
47
+ if (cell_val != undefined)
48
+ {
49
+ return self.__cell_format(cell_val, 'format_ok');
50
+ }
51
+ else
52
+ {
53
+ return '';
54
+ }
55
+ };
56
+ }
57
+ }
58
+ return col_model;
59
+ }
60
+
61
+
62
+
25
63
  /**
26
64
  * Get the filled cell data
27
65
  @alias module:Jqgrid_utils
@@ -32,7 +70,6 @@ module.exports = class Vanilla_website_utils
32
70
  var jqu = new Jqgrid_utils();
33
71
  col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
34
72
  */
35
-
36
73
  async get_filled_cell_table_data(_grid, fields=[])
37
74
  {
38
75
  let d = jQuery(_grid).jqGrid('getGridParam','data');
@@ -136,11 +173,11 @@ console.log(_data);
136
173
 
137
174
  /**
138
175
  * Hide a col_model column before load the grid
139
- @alias module:Jqgrid_utils
140
- @param {object} - col_model of the grid
141
- @param {string} - name of the column to hide
142
- @returns {object} col_model
143
- @example
176
+ * @alias module:Jqgrid_utils
177
+ * @param {object} - col_model of the grid
178
+ * @param {string} - name of the column to hide
179
+ * @returns {object} col_model
180
+ * @example
144
181
  if(filter['_filter'] == 'ch_p_higher_ch_plus_10pc')
145
182
  {
146
183
  col_model = await jqu.hide_column(col_model,'wholesale');
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.3.9"
32
+ "version": "1.4.2"
33
33
  }