jqgrid_utils 1.3.2 → 1.3.3
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 +21 -1
- package/dist/jqgrid_utils.js +41 -4
- package/jqgrid_utils.js +41 -4
- package/package.json +1 -1
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_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
|
|
39
40
|
* [module.exports#set_link(col_model, edit_field, url)](#exp_module_Jqgrid_utils--module.exports+set_link) ⇒ <code>string</code> ⏏
|
|
40
41
|
* [module.exports#s_grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+s_grid_set_caption) ⏏
|
|
41
42
|
* [module.exports#grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+grid_set_caption) ⏏
|
|
@@ -60,6 +61,24 @@ A module for Jqgrid_utils
|
|
|
60
61
|
* [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
|
|
61
62
|
* [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
|
|
62
63
|
|
|
64
|
+
<a name="exp_module_Jqgrid_utils--module.exports+get_filled_cell_data"></a>
|
|
65
|
+
|
|
66
|
+
### module.exports#get\_filled\_cell\_data(_grid, fields) ⇒ <code>object</code> ⏏
|
|
67
|
+
Get the filled cell data
|
|
68
|
+
|
|
69
|
+
**Kind**: Exported function
|
|
70
|
+
**Returns**: <code>object</code> - - json object of the colleted fields
|
|
71
|
+
|
|
72
|
+
| Param | Type | Description |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| _grid | <code>object</code> | the grid object or its name |
|
|
75
|
+
| fields | <code>array</code> | list of columns names what will be collected |
|
|
76
|
+
|
|
77
|
+
**Example**
|
|
78
|
+
```js
|
|
79
|
+
var jqu = new Jqgrid_utils();
|
|
80
|
+
col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
|
|
81
|
+
```
|
|
63
82
|
<a name="exp_module_Jqgrid_utils--module.exports+set_link"></a>
|
|
64
83
|
|
|
65
84
|
### module.exports#set\_link(col_model, edit_field, url) ⇒ <code>string</code> ⏏
|
|
@@ -77,7 +96,8 @@ Add an URL from the data to a specific cell/column
|
|
|
77
96
|
**Example**
|
|
78
97
|
```js
|
|
79
98
|
var jqu = new Jqgrid_utils();
|
|
80
|
-
|
|
99
|
+
let _data = await jqu.get_filled_cell_data(this,["P-","bulk","wholesale"]);
|
|
100
|
+
console.log(_data);
|
|
81
101
|
```
|
|
82
102
|
<a name="exp_module_Jqgrid_utils--module.exports+s_grid_set_caption"></a>
|
|
83
103
|
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -22,10 +22,46 @@ module.exports = class Vanilla_website_utils
|
|
|
22
22
|
|
|
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 {object} - json object of the colleted fields
|
|
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_data(_grid, fields=[])
|
|
26
38
|
{
|
|
27
|
-
|
|
28
|
-
|
|
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 = {'id':d[i]['id']};
|
|
47
|
+
for(let x in keys)
|
|
48
|
+
{
|
|
49
|
+
if(d[i].hasOwnProperty(keys[x]))
|
|
50
|
+
{
|
|
51
|
+
if(d[i][keys[x]] != "")
|
|
52
|
+
{
|
|
53
|
+
row[keys[x]] = d[i][keys[x]];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if(Object.keys(row).length > 1)
|
|
58
|
+
{
|
|
59
|
+
_data.push(row);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return _data;
|
|
64
|
+
}
|
|
29
65
|
|
|
30
66
|
/**
|
|
31
67
|
* Add an URL from the data to a specific cell/column
|
|
@@ -36,7 +72,8 @@ module.exports = class Vanilla_website_utils
|
|
|
36
72
|
@returns {string} https://foo.bar.com/av0_code/bar
|
|
37
73
|
@example
|
|
38
74
|
var jqu = new Jqgrid_utils();
|
|
39
|
-
|
|
75
|
+
let _data = await jqu.get_filled_cell_data(this,["P-","bulk","wholesale"]);
|
|
76
|
+
console.log(_data);
|
|
40
77
|
*/
|
|
41
78
|
async set_link(col_model, edit_field, url ,attr='')
|
|
42
79
|
{
|
package/jqgrid_utils.js
CHANGED
|
@@ -21,10 +21,46 @@ module.exports = class Vanilla_website_utils
|
|
|
21
21
|
|
|
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 {object} - json object of the colleted fields
|
|
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_data(_grid, fields=[])
|
|
25
37
|
{
|
|
26
|
-
|
|
27
|
-
|
|
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 = {'id':d[i]['id']};
|
|
46
|
+
for(let x in keys)
|
|
47
|
+
{
|
|
48
|
+
if(d[i].hasOwnProperty(keys[x]))
|
|
49
|
+
{
|
|
50
|
+
if(d[i][keys[x]] != "")
|
|
51
|
+
{
|
|
52
|
+
row[keys[x]] = d[i][keys[x]];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if(Object.keys(row).length > 1)
|
|
57
|
+
{
|
|
58
|
+
_data.push(row);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return _data;
|
|
63
|
+
}
|
|
28
64
|
|
|
29
65
|
/**
|
|
30
66
|
* Add an URL from the data to a specific cell/column
|
|
@@ -35,7 +71,8 @@ module.exports = class Vanilla_website_utils
|
|
|
35
71
|
@returns {string} https://foo.bar.com/av0_code/bar
|
|
36
72
|
@example
|
|
37
73
|
var jqu = new Jqgrid_utils();
|
|
38
|
-
|
|
74
|
+
let _data = await jqu.get_filled_cell_data(this,["P-","bulk","wholesale"]);
|
|
75
|
+
console.log(_data);
|
|
39
76
|
*/
|
|
40
77
|
async set_link(col_model, edit_field, url ,attr='')
|
|
41
78
|
{
|
package/package.json
CHANGED