jqgrid_utils 1.3.3 → 1.3.4

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
@@ -36,6 +36,7 @@ A module for Jqgrid_utils
36
36
 
37
37
 
38
38
  * [Jqgrid_utils](#module_Jqgrid_utils)
39
+ * [module.exports#get_filled_cell_table_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data) ⇒ <code>array</code> ⏏
39
40
  * [module.exports#get_filled_cell_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
40
41
  * [module.exports#set_link(col_model, edit_field, url)](#exp_module_Jqgrid_utils--module.exports+set_link) ⇒ <code>string</code> ⏏
41
42
  * [module.exports#s_grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+s_grid_set_caption) ⏏
@@ -61,6 +62,24 @@ A module for Jqgrid_utils
61
62
  * [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
62
63
  * [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
63
64
 
65
+ <a name="exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data"></a>
66
+
67
+ ### module.exports#get\_filled\_cell\_table\_data(_grid, fields) ⇒ <code>array</code> ⏏
68
+ Get the filled cell data
69
+
70
+ **Kind**: Exported function
71
+ **Returns**: <code>array</code> - - table array
72
+
73
+ | Param | Type | Description |
74
+ | --- | --- | --- |
75
+ | _grid | <code>object</code> | the grid object or its name |
76
+ | fields | <code>array</code> | list of columns names what will be collected |
77
+
78
+ **Example**
79
+ ```js
80
+ var jqu = new Jqgrid_utils();
81
+ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
82
+ ```
64
83
  <a name="exp_module_Jqgrid_utils--module.exports+get_filled_cell_data"></a>
65
84
 
66
85
  ### module.exports#get\_filled\_cell\_data(_grid, fields) ⇒ <code>object</code> ⏏
@@ -23,6 +23,49 @@ module.exports = class Vanilla_website_utils
23
23
  }
24
24
 
25
25
 
26
+ /**
27
+ * Get the filled cell data
28
+ @alias module:Jqgrid_utils
29
+ @param {object} - the grid object or its name
30
+ @param {array} - list of columns names what will be collected
31
+ @returns {array} - table array
32
+ @example
33
+ var jqu = new Jqgrid_utils();
34
+ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
35
+ */
36
+
37
+ async get_filled_cell_table_data(_grid, fields=[])
38
+ {
39
+ let d = jQuery(_grid).jqGrid('getGridParam','data');
40
+ let keys = fields;
41
+ let _data = [];
42
+ for(let i in d)
43
+ {
44
+ if(d[i].hasOwnProperty('id'))
45
+ {
46
+ let row = [d[i]['id']];
47
+ for(let x in keys)
48
+ {
49
+ if(d[i].hasOwnProperty(keys[x]))
50
+ {
51
+ row.push(d[i][keys[x]]);
52
+ }
53
+ else
54
+ {
55
+ row.push("");
56
+ }
57
+ }
58
+ var f = row.filter(function(value, index, arr){ return value !== "";});
59
+ if(Object.keys(f).length > 1)
60
+ {
61
+ _data.push(row);
62
+ }
63
+ }
64
+ }
65
+ return _data;
66
+ }
67
+
68
+
26
69
  /**
27
70
  * Get the filled cell data
28
71
  @alias module:Jqgrid_utils
package/jqgrid_utils.js CHANGED
@@ -22,6 +22,49 @@ module.exports = class Vanilla_website_utils
22
22
  }
23
23
 
24
24
 
25
+ /**
26
+ * Get the filled cell data
27
+ @alias module:Jqgrid_utils
28
+ @param {object} - the grid object or its name
29
+ @param {array} - list of columns names what will be collected
30
+ @returns {array} - table array
31
+ @example
32
+ var jqu = new Jqgrid_utils();
33
+ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
34
+ */
35
+
36
+ async get_filled_cell_table_data(_grid, fields=[])
37
+ {
38
+ let d = jQuery(_grid).jqGrid('getGridParam','data');
39
+ let keys = fields;
40
+ let _data = [];
41
+ for(let i in d)
42
+ {
43
+ if(d[i].hasOwnProperty('id'))
44
+ {
45
+ let row = [d[i]['id']];
46
+ for(let x in keys)
47
+ {
48
+ if(d[i].hasOwnProperty(keys[x]))
49
+ {
50
+ row.push(d[i][keys[x]]);
51
+ }
52
+ else
53
+ {
54
+ row.push("");
55
+ }
56
+ }
57
+ var f = row.filter(function(value, index, arr){ return value !== "";});
58
+ if(Object.keys(f).length > 1)
59
+ {
60
+ _data.push(row);
61
+ }
62
+ }
63
+ }
64
+ return _data;
65
+ }
66
+
67
+
25
68
  /**
26
69
  * Get the filled cell data
27
70
  @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.3.3"
32
+ "version": "1.3.4"
33
33
  }