jqgrid_utils 1.3.4 → 1.3.8
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 +53 -9
- package/dist/jqgrid_utils.js +66 -6
- package/jqgrid_utils.js +66 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,8 @@ A module for Jqgrid_utils
|
|
|
38
38
|
* [Jqgrid_utils](#module_Jqgrid_utils)
|
|
39
39
|
* [module.exports#get_filled_cell_table_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data) ⇒ <code>array</code> ⏏
|
|
40
40
|
* [module.exports#get_filled_cell_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
|
|
41
|
-
* [module.exports#set_link(col_model, edit_field, url)](#exp_module_Jqgrid_utils--module.exports+set_link) ⇒ <code>
|
|
41
|
+
* [module.exports#set_link(col_model, edit_field, url)](#exp_module_Jqgrid_utils--module.exports+set_link) ⇒ <code>object</code> ⏏
|
|
42
|
+
* [module.exports#hide_column(col_model, field)](#exp_module_Jqgrid_utils--module.exports+hide_column) ⇒ <code>object</code> ⏏
|
|
42
43
|
* [module.exports#s_grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+s_grid_set_caption) ⏏
|
|
43
44
|
* [module.exports#grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+grid_set_caption) ⏏
|
|
44
45
|
* [module.exports#s_resize_saved_cell_width(col_model, page, grid)](#exp_module_Jqgrid_utils--module.exports+s_resize_saved_cell_width) ⏏
|
|
@@ -57,7 +58,7 @@ A module for Jqgrid_utils
|
|
|
57
58
|
* [module.exports#add_link_details_separator(col_model, url, edit_field, attr, keys)](#exp_module_Jqgrid_utils--module.exports+add_link_details_separator) ⏏
|
|
58
59
|
* [module.exports#add_link_separator(col_model, url, edit_field, fields)](#exp_module_Jqgrid_utils--module.exports+add_link_separator) ⏏
|
|
59
60
|
* [module.exports#__cell_format()](#exp_module_Jqgrid_utils--module.exports+__cell_format) ⏏
|
|
60
|
-
* [module.exports#subgrid(_id, id,
|
|
61
|
+
* [module.exports#subgrid(_id, id, url, col_model, caption)](#exp_module_Jqgrid_utils--module.exports+subgrid) ⏏
|
|
61
62
|
* [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Jqgrid_utils--module.exports+add_image) ⏏
|
|
62
63
|
* [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
|
|
63
64
|
* [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
|
|
@@ -100,11 +101,11 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
|
|
|
100
101
|
```
|
|
101
102
|
<a name="exp_module_Jqgrid_utils--module.exports+set_link"></a>
|
|
102
103
|
|
|
103
|
-
### module.exports#set\_link(col_model, edit_field, url) ⇒ <code>
|
|
104
|
+
### module.exports#set\_link(col_model, edit_field, url) ⇒ <code>object</code> ⏏
|
|
104
105
|
Add an URL from the data to a specific cell/column
|
|
105
106
|
|
|
106
107
|
**Kind**: Exported function
|
|
107
|
-
**Returns**: <code>
|
|
108
|
+
**Returns**: <code>object</code> - https://foo.bar.com/av0_code/bar
|
|
108
109
|
|
|
109
110
|
| Param | Type | Description |
|
|
110
111
|
| --- | --- | --- |
|
|
@@ -118,6 +119,27 @@ var jqu = new Jqgrid_utils();
|
|
|
118
119
|
let _data = await jqu.get_filled_cell_data(this,["P-","bulk","wholesale"]);
|
|
119
120
|
console.log(_data);
|
|
120
121
|
```
|
|
122
|
+
<a name="exp_module_Jqgrid_utils--module.exports+hide_column"></a>
|
|
123
|
+
|
|
124
|
+
### module.exports#hide\_column(col_model, field) ⇒ <code>object</code> ⏏
|
|
125
|
+
Hide a col_model column before load the grid
|
|
126
|
+
|
|
127
|
+
**Kind**: Exported function
|
|
128
|
+
**Returns**: <code>object</code> - col_model
|
|
129
|
+
|
|
130
|
+
| Param | Type | Description |
|
|
131
|
+
| --- | --- | --- |
|
|
132
|
+
| col_model | <code>object</code> | col_model of the grid |
|
|
133
|
+
| field | <code>string</code> | name of the column to hide |
|
|
134
|
+
|
|
135
|
+
**Example**
|
|
136
|
+
```js
|
|
137
|
+
if(filter['_filter'] == 'ch_p_higher_ch_plus_10pc')
|
|
138
|
+
{
|
|
139
|
+
col_model = await jqu.hide_column(col_model,'wholesale');
|
|
140
|
+
col_model = await jqu.hide_column(col_model,'wholesale_formula');
|
|
141
|
+
}
|
|
142
|
+
```
|
|
121
143
|
<a name="exp_module_Jqgrid_utils--module.exports+s_grid_set_caption"></a>
|
|
122
144
|
|
|
123
145
|
### module.exports#s\_grid\_set\_caption(_grid, data) ⏏
|
|
@@ -443,22 +465,44 @@ Private Function
|
|
|
443
465
|
**Kind**: Exported function
|
|
444
466
|
<a name="exp_module_Jqgrid_utils--module.exports+subgrid"></a>
|
|
445
467
|
|
|
446
|
-
### module.exports#subgrid(_id, id,
|
|
468
|
+
### module.exports#subgrid(_id, id, url, col_model, caption) ⏏
|
|
447
469
|
**Kind**: Exported function
|
|
448
470
|
|
|
449
471
|
| Param | Type | Description |
|
|
450
472
|
| --- | --- | --- |
|
|
451
473
|
| _id | <code>string</code> | row_id |
|
|
452
474
|
| id | <code>string</code> | data id |
|
|
453
|
-
|
|
|
475
|
+
| url | <code>string</code> | url to request |
|
|
454
476
|
| col_model | <code>object</code> | col_model for the table |
|
|
455
477
|
| caption | <code>string</code> | Add to the caption of the subgrid |
|
|
456
478
|
|
|
457
479
|
**Example**
|
|
458
480
|
```js
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
let
|
|
481
|
+
subGrid: true,
|
|
482
|
+
,subGridRowExpanded: async function(_id, id) {
|
|
483
|
+
let data_url2 = api + '/process_locations?f=data&process=';
|
|
484
|
+
let col_model_url2 = api + '/process_locations?f=col_model';
|
|
485
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
486
|
+
await jqu.subgrid(_id, id, data_url2, col_model2,'Locations for Process');
|
|
487
|
+
|
|
488
|
+
let data_url = api + '/process_styles?f=data&process=';
|
|
489
|
+
let col_model_url = api + '/process_styles?f=col_model';
|
|
490
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url));
|
|
491
|
+
await jqu.subgrid(_id, id, data_url, col_model,'Styles for Process');
|
|
492
|
+
},
|
|
493
|
+
|
|
494
|
+
or
|
|
495
|
+
|
|
496
|
+
subGrid: true,
|
|
497
|
+
subGridRowExpanded: async function(_id, id) {
|
|
498
|
+
let row_data = jQuery(this).jqGrid ('getRowData', id);
|
|
499
|
+
let param={f:'data','style':row_data['style'],pricelist:'P-TENENGR1'};
|
|
500
|
+
let data_url = api + '/order_ln';
|
|
501
|
+
data_url = await add_parameters(data_url, param);
|
|
502
|
+
let col_model_url2 = api + '/order_ln?f=col_model';
|
|
503
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
504
|
+
await jqu.subgrid(_id, false, data_url, col_model2,'Order Lines for ' + row_data['style']);
|
|
505
|
+
},
|
|
462
506
|
```
|
|
463
507
|
<a name="exp_module_Jqgrid_utils--module.exports+add_image"></a>
|
|
464
508
|
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -112,7 +112,7 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
|
|
|
112
112
|
@param {object} - col_model of the grid
|
|
113
113
|
@param {string} - name of the column what should get convert to the url
|
|
114
114
|
@param {string} - the used url of the data
|
|
115
|
-
@returns {
|
|
115
|
+
@returns {object} https://foo.bar.com/av0_code/bar
|
|
116
116
|
@example
|
|
117
117
|
var jqu = new Jqgrid_utils();
|
|
118
118
|
let _data = await jqu.get_filled_cell_data(this,["P-","bulk","wholesale"]);
|
|
@@ -133,6 +133,36 @@ console.log(_data);
|
|
|
133
133
|
return col_model;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 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
|
|
145
|
+
if(filter['_filter'] == 'ch_p_higher_ch_plus_10pc')
|
|
146
|
+
{
|
|
147
|
+
col_model = await jqu.hide_column(col_model,'wholesale');
|
|
148
|
+
col_model = await jqu.hide_column(col_model,'wholesale_formula');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
*/
|
|
152
|
+
async hide_column(col_model,field)
|
|
153
|
+
{
|
|
154
|
+
for(let i=0;i< col_model.length;i++)
|
|
155
|
+
{
|
|
156
|
+
if(col_model[i]['name'] === field)
|
|
157
|
+
{
|
|
158
|
+
console.log("fffffffF");
|
|
159
|
+
col_model[i]['hidden'] = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return col_model;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
136
166
|
/**
|
|
137
167
|
@alias module:Jqgrid_utils
|
|
138
168
|
@param {object} - gridobject;
|
|
@@ -738,14 +768,44 @@ __cell_format(cell_value, format)
|
|
|
738
768
|
@param {object} - col_model for the table
|
|
739
769
|
@param {string} - Add to the caption of the subgrid
|
|
740
770
|
@example
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
let
|
|
771
|
+
subGrid: true,
|
|
772
|
+
,subGridRowExpanded: async function(_id, id) {
|
|
773
|
+
let data_url2 = api + '/process_locations?f=data&process=';
|
|
774
|
+
let col_model_url2 = api + '/process_locations?f=col_model';
|
|
775
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
776
|
+
await jqu.subgrid(_id, id, data_url2, col_model2,'Locations for Process');
|
|
777
|
+
|
|
778
|
+
let data_url = api + '/process_styles?f=data&process=';
|
|
779
|
+
let col_model_url = api + '/process_styles?f=col_model';
|
|
780
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url));
|
|
781
|
+
await jqu.subgrid(_id, id, data_url, col_model,'Styles for Process');
|
|
782
|
+
},
|
|
783
|
+
|
|
784
|
+
or
|
|
785
|
+
|
|
786
|
+
subGrid: true,
|
|
787
|
+
subGridRowExpanded: async function(_id, id) {
|
|
788
|
+
let row_data = jQuery(this).jqGrid ('getRowData', id);
|
|
789
|
+
let param={f:'data','style':row_data['style'],pricelist:'P-TENENGR1'};
|
|
790
|
+
let data_url = api + '/order_ln';
|
|
791
|
+
data_url = await add_parameters(data_url, param);
|
|
792
|
+
let col_model_url2 = api + '/order_ln?f=col_model';
|
|
793
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
794
|
+
await jqu.subgrid(_id, false, data_url, col_model2,'Order Lines for ' + row_data['style']);
|
|
795
|
+
},
|
|
796
|
+
|
|
744
797
|
*/
|
|
745
|
-
async subgrid(_id, id,
|
|
798
|
+
async subgrid(_id, id, url, col_model, caption='' )
|
|
746
799
|
{
|
|
747
800
|
caption = caption != '' ? caption + ' ' : '';
|
|
748
|
-
|
|
801
|
+
if(id)
|
|
802
|
+
{
|
|
803
|
+
url += id;
|
|
804
|
+
}
|
|
805
|
+
else
|
|
806
|
+
{
|
|
807
|
+
id = '';
|
|
808
|
+
}
|
|
749
809
|
let $s1 = jQuery("<table style='margin: 5px 0' class='" + _id + "_t'></table>");
|
|
750
810
|
$s1.appendTo("#" + jQuery.jgrid.jqID(_id));
|
|
751
811
|
$s1.jqGrid({
|
package/jqgrid_utils.js
CHANGED
|
@@ -111,7 +111,7 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
|
|
|
111
111
|
@param {object} - col_model of the grid
|
|
112
112
|
@param {string} - name of the column what should get convert to the url
|
|
113
113
|
@param {string} - the used url of the data
|
|
114
|
-
@returns {
|
|
114
|
+
@returns {object} https://foo.bar.com/av0_code/bar
|
|
115
115
|
@example
|
|
116
116
|
var jqu = new Jqgrid_utils();
|
|
117
117
|
let _data = await jqu.get_filled_cell_data(this,["P-","bulk","wholesale"]);
|
|
@@ -132,6 +132,36 @@ console.log(_data);
|
|
|
132
132
|
return col_model;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 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
|
|
144
|
+
if(filter['_filter'] == 'ch_p_higher_ch_plus_10pc')
|
|
145
|
+
{
|
|
146
|
+
col_model = await jqu.hide_column(col_model,'wholesale');
|
|
147
|
+
col_model = await jqu.hide_column(col_model,'wholesale_formula');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
*/
|
|
151
|
+
async hide_column(col_model,field)
|
|
152
|
+
{
|
|
153
|
+
for(let i=0;i< col_model.length;i++)
|
|
154
|
+
{
|
|
155
|
+
if(col_model[i]['name'] === field)
|
|
156
|
+
{
|
|
157
|
+
console.log("fffffffF");
|
|
158
|
+
col_model[i]['hidden'] = true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return col_model;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
135
165
|
/**
|
|
136
166
|
@alias module:Jqgrid_utils
|
|
137
167
|
@param {object} - gridobject;
|
|
@@ -737,14 +767,44 @@ __cell_format(cell_value, format)
|
|
|
737
767
|
@param {object} - col_model for the table
|
|
738
768
|
@param {string} - Add to the caption of the subgrid
|
|
739
769
|
@example
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
let
|
|
770
|
+
subGrid: true,
|
|
771
|
+
,subGridRowExpanded: async function(_id, id) {
|
|
772
|
+
let data_url2 = api + '/process_locations?f=data&process=';
|
|
773
|
+
let col_model_url2 = api + '/process_locations?f=col_model';
|
|
774
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
775
|
+
await jqu.subgrid(_id, id, data_url2, col_model2,'Locations for Process');
|
|
776
|
+
|
|
777
|
+
let data_url = api + '/process_styles?f=data&process=';
|
|
778
|
+
let col_model_url = api + '/process_styles?f=col_model';
|
|
779
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url));
|
|
780
|
+
await jqu.subgrid(_id, id, data_url, col_model,'Styles for Process');
|
|
781
|
+
},
|
|
782
|
+
|
|
783
|
+
or
|
|
784
|
+
|
|
785
|
+
subGrid: true,
|
|
786
|
+
subGridRowExpanded: async function(_id, id) {
|
|
787
|
+
let row_data = jQuery(this).jqGrid ('getRowData', id);
|
|
788
|
+
let param={f:'data','style':row_data['style'],pricelist:'P-TENENGR1'};
|
|
789
|
+
let data_url = api + '/order_ln';
|
|
790
|
+
data_url = await add_parameters(data_url, param);
|
|
791
|
+
let col_model_url2 = api + '/order_ln?f=col_model';
|
|
792
|
+
let col_model2 = JSON.parse(await vwu.aget_api(col_model_url2));
|
|
793
|
+
await jqu.subgrid(_id, false, data_url, col_model2,'Order Lines for ' + row_data['style']);
|
|
794
|
+
},
|
|
795
|
+
|
|
743
796
|
*/
|
|
744
|
-
async subgrid(_id, id,
|
|
797
|
+
async subgrid(_id, id, url, col_model, caption='' )
|
|
745
798
|
{
|
|
746
799
|
caption = caption != '' ? caption + ' ' : '';
|
|
747
|
-
|
|
800
|
+
if(id)
|
|
801
|
+
{
|
|
802
|
+
url += id;
|
|
803
|
+
}
|
|
804
|
+
else
|
|
805
|
+
{
|
|
806
|
+
id = '';
|
|
807
|
+
}
|
|
748
808
|
let $s1 = jQuery("<table style='margin: 5px 0' class='" + _id + "_t'></table>");
|
|
749
809
|
$s1.appendTo("#" + jQuery.jgrid.jqID(_id));
|
|
750
810
|
$s1.jqGrid({
|
package/package.json
CHANGED