jqgrid_utils 1.3.3 → 1.3.7
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 +47 -6
- package/dist/jqgrid_utils.js +78 -5
- package/jqgrid_utils.js +78 -5
- 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_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) ⏏
|
|
@@ -56,11 +57,29 @@ A module for Jqgrid_utils
|
|
|
56
57
|
* [module.exports#add_link_details_separator(col_model, url, edit_field, attr, keys)](#exp_module_Jqgrid_utils--module.exports+add_link_details_separator) ⏏
|
|
57
58
|
* [module.exports#add_link_separator(col_model, url, edit_field, fields)](#exp_module_Jqgrid_utils--module.exports+add_link_separator) ⏏
|
|
58
59
|
* [module.exports#__cell_format()](#exp_module_Jqgrid_utils--module.exports+__cell_format) ⏏
|
|
59
|
-
* [module.exports#subgrid(_id, id,
|
|
60
|
+
* [module.exports#subgrid(_id, id, url, col_model, caption)](#exp_module_Jqgrid_utils--module.exports+subgrid) ⏏
|
|
60
61
|
* [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Jqgrid_utils--module.exports+add_image) ⏏
|
|
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> ⏏
|
|
@@ -424,22 +443,44 @@ Private Function
|
|
|
424
443
|
**Kind**: Exported function
|
|
425
444
|
<a name="exp_module_Jqgrid_utils--module.exports+subgrid"></a>
|
|
426
445
|
|
|
427
|
-
### module.exports#subgrid(_id, id,
|
|
446
|
+
### module.exports#subgrid(_id, id, url, col_model, caption) ⏏
|
|
428
447
|
**Kind**: Exported function
|
|
429
448
|
|
|
430
449
|
| Param | Type | Description |
|
|
431
450
|
| --- | --- | --- |
|
|
432
451
|
| _id | <code>string</code> | row_id |
|
|
433
452
|
| id | <code>string</code> | data id |
|
|
434
|
-
|
|
|
453
|
+
| url | <code>string</code> | url to request |
|
|
435
454
|
| col_model | <code>object</code> | col_model for the table |
|
|
436
455
|
| caption | <code>string</code> | Add to the caption of the subgrid |
|
|
437
456
|
|
|
438
457
|
**Example**
|
|
439
458
|
```js
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
let
|
|
459
|
+
subGrid: true,
|
|
460
|
+
,subGridRowExpanded: async function(_id, id) {
|
|
461
|
+
let data_url2 = api + '/process_locations?f=data&process=';
|
|
462
|
+
let col_model_url2 = api + '/process_locations?f=col_model';
|
|
463
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
464
|
+
await jqu.subgrid(_id, id, data_url2, col_model2,'Locations for Process');
|
|
465
|
+
|
|
466
|
+
let data_url = api + '/process_styles?f=data&process=';
|
|
467
|
+
let col_model_url = api + '/process_styles?f=col_model';
|
|
468
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url));
|
|
469
|
+
await jqu.subgrid(_id, id, data_url, col_model,'Styles for Process');
|
|
470
|
+
},
|
|
471
|
+
|
|
472
|
+
or
|
|
473
|
+
|
|
474
|
+
subGrid: true,
|
|
475
|
+
subGridRowExpanded: async function(_id, id) {
|
|
476
|
+
let row_data = jQuery(this).jqGrid ('getRowData', id);
|
|
477
|
+
let param={f:'data','style':row_data['style'],pricelist:'P-TENENGR1'};
|
|
478
|
+
let data_url = api + '/order_ln';
|
|
479
|
+
data_url = await add_parameters(data_url, param);
|
|
480
|
+
let col_model_url2 = api + '/order_ln?f=col_model';
|
|
481
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
482
|
+
await jqu.subgrid(_id, false, data_url, col_model2,'Order Lines for ' + row_data['style']);
|
|
483
|
+
},
|
|
443
484
|
```
|
|
444
485
|
<a name="exp_module_Jqgrid_utils--module.exports+add_image"></a>
|
|
445
486
|
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -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
|
|
@@ -695,14 +738,44 @@ __cell_format(cell_value, format)
|
|
|
695
738
|
@param {object} - col_model for the table
|
|
696
739
|
@param {string} - Add to the caption of the subgrid
|
|
697
740
|
@example
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
let
|
|
741
|
+
subGrid: true,
|
|
742
|
+
,subGridRowExpanded: async function(_id, id) {
|
|
743
|
+
let data_url2 = api + '/process_locations?f=data&process=';
|
|
744
|
+
let col_model_url2 = api + '/process_locations?f=col_model';
|
|
745
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
746
|
+
await jqu.subgrid(_id, id, data_url2, col_model2,'Locations for Process');
|
|
747
|
+
|
|
748
|
+
let data_url = api + '/process_styles?f=data&process=';
|
|
749
|
+
let col_model_url = api + '/process_styles?f=col_model';
|
|
750
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url));
|
|
751
|
+
await jqu.subgrid(_id, id, data_url, col_model,'Styles for Process');
|
|
752
|
+
},
|
|
753
|
+
|
|
754
|
+
or
|
|
755
|
+
|
|
756
|
+
subGrid: true,
|
|
757
|
+
subGridRowExpanded: async function(_id, id) {
|
|
758
|
+
let row_data = jQuery(this).jqGrid ('getRowData', id);
|
|
759
|
+
let param={f:'data','style':row_data['style'],pricelist:'P-TENENGR1'};
|
|
760
|
+
let data_url = api + '/order_ln';
|
|
761
|
+
data_url = await add_parameters(data_url, param);
|
|
762
|
+
let col_model_url2 = api + '/order_ln?f=col_model';
|
|
763
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
764
|
+
await jqu.subgrid(_id, false, data_url, col_model2,'Order Lines for ' + row_data['style']);
|
|
765
|
+
},
|
|
766
|
+
|
|
701
767
|
*/
|
|
702
|
-
async subgrid(_id, id,
|
|
768
|
+
async subgrid(_id, id, url, col_model, caption='' )
|
|
703
769
|
{
|
|
704
770
|
caption = caption != '' ? caption + ' ' : '';
|
|
705
|
-
|
|
771
|
+
if(id)
|
|
772
|
+
{
|
|
773
|
+
url += id;
|
|
774
|
+
}
|
|
775
|
+
else
|
|
776
|
+
{
|
|
777
|
+
id = '';
|
|
778
|
+
}
|
|
706
779
|
let $s1 = jQuery("<table style='margin: 5px 0' class='" + _id + "_t'></table>");
|
|
707
780
|
$s1.appendTo("#" + jQuery.jgrid.jqID(_id));
|
|
708
781
|
$s1.jqGrid({
|
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
|
|
@@ -694,14 +737,44 @@ __cell_format(cell_value, format)
|
|
|
694
737
|
@param {object} - col_model for the table
|
|
695
738
|
@param {string} - Add to the caption of the subgrid
|
|
696
739
|
@example
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
let
|
|
740
|
+
subGrid: true,
|
|
741
|
+
,subGridRowExpanded: async function(_id, id) {
|
|
742
|
+
let data_url2 = api + '/process_locations?f=data&process=';
|
|
743
|
+
let col_model_url2 = api + '/process_locations?f=col_model';
|
|
744
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
745
|
+
await jqu.subgrid(_id, id, data_url2, col_model2,'Locations for Process');
|
|
746
|
+
|
|
747
|
+
let data_url = api + '/process_styles?f=data&process=';
|
|
748
|
+
let col_model_url = api + '/process_styles?f=col_model';
|
|
749
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url));
|
|
750
|
+
await jqu.subgrid(_id, id, data_url, col_model,'Styles for Process');
|
|
751
|
+
},
|
|
752
|
+
|
|
753
|
+
or
|
|
754
|
+
|
|
755
|
+
subGrid: true,
|
|
756
|
+
subGridRowExpanded: async function(_id, id) {
|
|
757
|
+
let row_data = jQuery(this).jqGrid ('getRowData', id);
|
|
758
|
+
let param={f:'data','style':row_data['style'],pricelist:'P-TENENGR1'};
|
|
759
|
+
let data_url = api + '/order_ln';
|
|
760
|
+
data_url = await add_parameters(data_url, param);
|
|
761
|
+
let col_model_url2 = api + '/order_ln?f=col_model';
|
|
762
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
763
|
+
await jqu.subgrid(_id, false, data_url, col_model2,'Order Lines for ' + row_data['style']);
|
|
764
|
+
},
|
|
765
|
+
|
|
700
766
|
*/
|
|
701
|
-
async subgrid(_id, id,
|
|
767
|
+
async subgrid(_id, id, url, col_model, caption='' )
|
|
702
768
|
{
|
|
703
769
|
caption = caption != '' ? caption + ' ' : '';
|
|
704
|
-
|
|
770
|
+
if(id)
|
|
771
|
+
{
|
|
772
|
+
url += id;
|
|
773
|
+
}
|
|
774
|
+
else
|
|
775
|
+
{
|
|
776
|
+
id = '';
|
|
777
|
+
}
|
|
705
778
|
let $s1 = jQuery("<table style='margin: 5px 0' class='" + _id + "_t'></table>");
|
|
706
779
|
$s1.appendTo("#" + jQuery.jgrid.jqID(_id));
|
|
707
780
|
$s1.jqGrid({
|
package/package.json
CHANGED