jqgrid_utils 1.2.3 → 1.2.6

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
@@ -63,8 +63,7 @@ A module for Vanilla_website_utils
63
63
  * [Vanilla_website_utils](#module_Vanilla_website_utils)
64
64
  * [module.exports#set_link()](#exp_module_Vanilla_website_utils--module.exports+set_link) ⏏
65
65
  * [module.exports#grid_set_captain()](#exp_module_Vanilla_website_utils--module.exports+grid_set_captain) ⏏
66
- * [module.exports#resize_saved_cell_width()](#exp_module_Vanilla_website_utils--module.exports+resize_saved_cell_width) ⏏
67
- * [module.exports#resize_cell()](#exp_module_Vanilla_website_utils--module.exports+resize_cell) ⏏
66
+ * [module.exports#resize_saved_cell_width(col_model, page, grid)](#exp_module_Vanilla_website_utils--module.exports+resize_saved_cell_width) ⏏
68
67
  * [module.exports#upsert_row()](#exp_module_Vanilla_website_utils--module.exports+upsert_row) ⏏
69
68
  * [module.exports#insert_row()](#exp_module_Vanilla_website_utils--module.exports+insert_row) ⏏
70
69
  * [module.exports#update_row()](#exp_module_Vanilla_website_utils--module.exports+update_row) ⏏
@@ -76,7 +75,7 @@ A module for Vanilla_website_utils
76
75
  * [module.exports#add_link_details()](#exp_module_Vanilla_website_utils--module.exports+add_link_details) ⏏
77
76
  * [module.exports#add_link_details_separator()](#exp_module_Vanilla_website_utils--module.exports+add_link_details_separator) ⏏
78
77
  * [module.exports#__cell_format()](#exp_module_Vanilla_website_utils--module.exports+__cell_format) ⏏
79
- * [module.exports#subgrid(_id, id, data_url, col_model)](#exp_module_Vanilla_website_utils--module.exports+subgrid) ⏏
78
+ * [module.exports#subgrid(_id, id, data_url, col_model, caption)](#exp_module_Vanilla_website_utils--module.exports+subgrid) ⏏
80
79
  * [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Vanilla_website_utils--module.exports+add_image) ⏏
81
80
 
82
81
  <a name="exp_module_Vanilla_website_utils--module.exports+set_link"></a>
@@ -89,12 +88,19 @@ A module for Vanilla_website_utils
89
88
  **Kind**: Exported function
90
89
  <a name="exp_module_Vanilla_website_utils--module.exports+resize_saved_cell_width"></a>
91
90
 
92
- ### module.exports#resize\_saved\_cell\_width() ⏏
91
+ ### module.exports#resize\_saved\_cell\_width(col_model, page, grid) ⏏
93
92
  **Kind**: Exported function
94
- <a name="exp_module_Vanilla_website_utils--module.exports+resize_cell"></a>
95
93
 
96
- ### module.exports#resize\_cell()
97
- **Kind**: Exported function
94
+ | Param | Type | Default | Description |
95
+ | --- | --- | --- | --- |
96
+ | col_model | <code>object</code> | | the col_model of the grid |
97
+ | page | <code>string</code> | <code>false</code> | the name of the page(optional) |
98
+ | grid | <code>object</code> | <code>false</code> | the grid objec(optional) |
99
+
100
+ **Example**
101
+ ```js
102
+ col_model = await jqu.resize_saved_cell_width(col_model);
103
+ ```
98
104
  <a name="exp_module_Vanilla_website_utils--module.exports+upsert_row"></a>
99
105
 
100
106
  ### module.exports#upsert\_row() ⏏
@@ -133,7 +139,7 @@ A module for Vanilla_website_utils
133
139
  **Kind**: Exported function
134
140
  **Example**
135
141
  ```js
136
- // example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
142
+ example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
137
143
  ```
138
144
  <a name="exp_module_Vanilla_website_utils--module.exports+add_link_details_separator"></a>
139
145
 
@@ -141,7 +147,7 @@ A module for Vanilla_website_utils
141
147
  **Kind**: Exported function
142
148
  **Example**
143
149
  ```js
144
- // col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
150
+ col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
145
151
  ```
146
152
  <a name="exp_module_Vanilla_website_utils--module.exports+__cell_format"></a>
147
153
 
@@ -149,15 +155,16 @@ A module for Vanilla_website_utils
149
155
  **Kind**: Exported function
150
156
  <a name="exp_module_Vanilla_website_utils--module.exports+subgrid"></a>
151
157
 
152
- ### module.exports#subgrid(_id, id, data_url, col_model) ⏏
158
+ ### module.exports#subgrid(_id, id, data_url, col_model, caption) ⏏
153
159
  **Kind**: Exported function
154
160
 
155
161
  | Param | Type | Description |
156
162
  | --- | --- | --- |
157
163
  | _id | <code>string</code> | row_id |
158
164
  | id | <code>string</code> | data id |
159
- | data_url | <code>object</code> | col_model for the table |
160
- | col_model | <code>string</code> | Caption |
165
+ | data_url | <code>string</code> | url to request |
166
+ | col_model | <code>object</code> | col_model for the table |
167
+ | caption | <code>string</code> | Add to the caption of the subgrid |
161
168
 
162
169
  **Example**
163
170
  ```js
@@ -78,8 +78,15 @@ module.exports = class Vanilla_website_utils
78
78
  {
79
79
  this.grid_set_captain(col_model, page, grid);
80
80
  }
81
+
82
+
81
83
  /**
82
84
  @alias module:Vanilla_website_utils
85
+ @param {object} - the col_model of the grid
86
+ @param {string} - the name of the page(optional)
87
+ @param {object} - the grid objec(optional)
88
+ @example
89
+ * col_model = await jqu.resize_saved_cell_width(col_model);
83
90
  */
84
91
  async resize_saved_cell_width(col_model,page=false, grid=false)
85
92
  {
@@ -87,10 +94,17 @@ module.exports = class Vanilla_website_utils
87
94
  key += grid ? '-' + grid + '-w-' : '-grid-w-';
88
95
  for(let x = 0; x<= col_model.length; x++)
89
96
  {
90
- const width = localStorage.getItem(key + x);
91
- if(width)
97
+ if(col_model[x])
92
98
  {
93
- col_model[x]['width'] = width;
99
+ if(col_model[x]['name'])
100
+ {
101
+ const name = col_model[x]['name'];
102
+ const width = localStorage.getItem(key + name);
103
+ if(width)
104
+ {
105
+ col_model[x]['width'] = width;
106
+ }
107
+ }
94
108
  }
95
109
  }
96
110
  return col_model;
@@ -98,16 +112,30 @@ module.exports = class Vanilla_website_utils
98
112
 
99
113
  /**
100
114
  @alias module:Vanilla_website_utils
115
+ * resize_cell
116
+ * call after resize a column
117
+ @param {string} the width of the resized column
118
+ @param {string} column number what get resized
119
+ @param {string} not in use yet
120
+ @example
121
+ * var jqu = new Jqgrid_utils({page:'mypage'});
122
+ * resizeStop: jqu.resize_cell,
101
123
  */
102
124
  resize_cell(width, index, _page=false)
103
125
  {
104
- const page = _page ? _page : localStorage.getItem('page');
105
- const grid = this.id;
106
- let idx = index-1;
107
- let key = page + '-' + grid + '-w-' + idx;
108
- localStorage.setItem(key, width);
109
- const cat = localStorage.getItem(key);
110
- console.log(key);
126
+ const col_model = jQuery(this).jqGrid ('getGridParam', 'colModel');
127
+ if(col_model[index])
128
+ {
129
+ if(col_model[index]['name'])
130
+ {
131
+ const name = col_model[index]['name'];
132
+ const page = _page ? _page : localStorage.getItem('page');
133
+ const grid = this.id;
134
+ let key = page + '-' + grid + '-w-' + name;
135
+ localStorage.setItem(key, width);
136
+ const cat = localStorage.getItem(key);
137
+ }
138
+ }
111
139
  }
112
140
 
113
141
 
@@ -265,7 +293,7 @@ async hide_del_icon()
265
293
  /**
266
294
  @alias module:Vanilla_website_utils
267
295
  @example
268
- // example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
296
+ * example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
269
297
  */
270
298
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
271
299
  {
@@ -337,7 +365,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
337
365
  /**
338
366
  @alias module:Vanilla_website_utils
339
367
  @example
340
- // col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
368
+ * col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
341
369
  */
342
370
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
343
371
  {
@@ -426,8 +454,9 @@ __cell_format(cell_value, format)
426
454
  @alias module:Vanilla_website_utils
427
455
  @param {string} - row_id
428
456
  @param {string} - data id
457
+ @param {string} - url to request
429
458
  @param {object} - col_model for the table
430
- @param {string} - Caption
459
+ @param {string} - Add to the caption of the subgrid
431
460
  @example
432
461
  * let data_url = api + '/phone_detail?f=data&_id=';
433
462
  * let col_model_url = api + '/phone_detail?f=col_model';
package/jqgrid_utils.js CHANGED
@@ -77,8 +77,15 @@ module.exports = class Vanilla_website_utils
77
77
  {
78
78
  this.grid_set_captain(col_model, page, grid);
79
79
  }
80
+
81
+
80
82
  /**
81
83
  @alias module:Vanilla_website_utils
84
+ @param {object} - the col_model of the grid
85
+ @param {string} - the name of the page(optional)
86
+ @param {object} - the grid objec(optional)
87
+ @example
88
+ * col_model = await jqu.resize_saved_cell_width(col_model);
82
89
  */
83
90
  async resize_saved_cell_width(col_model,page=false, grid=false)
84
91
  {
@@ -86,10 +93,17 @@ module.exports = class Vanilla_website_utils
86
93
  key += grid ? '-' + grid + '-w-' : '-grid-w-';
87
94
  for(let x = 0; x<= col_model.length; x++)
88
95
  {
89
- const width = localStorage.getItem(key + x);
90
- if(width)
96
+ if(col_model[x])
91
97
  {
92
- col_model[x]['width'] = width;
98
+ if(col_model[x]['name'])
99
+ {
100
+ const name = col_model[x]['name'];
101
+ const width = localStorage.getItem(key + name);
102
+ if(width)
103
+ {
104
+ col_model[x]['width'] = width;
105
+ }
106
+ }
93
107
  }
94
108
  }
95
109
  return col_model;
@@ -97,16 +111,30 @@ module.exports = class Vanilla_website_utils
97
111
 
98
112
  /**
99
113
  @alias module:Vanilla_website_utils
114
+ * resize_cell
115
+ * call after resize a column
116
+ @param {string} the width of the resized column
117
+ @param {string} column number what get resized
118
+ @param {string} not in use yet
119
+ @example
120
+ * var jqu = new Jqgrid_utils({page:'mypage'});
121
+ * resizeStop: jqu.resize_cell,
100
122
  */
101
123
  resize_cell(width, index, _page=false)
102
124
  {
103
- const page = _page ? _page : localStorage.getItem('page');
104
- const grid = this.id;
105
- let idx = index-1;
106
- let key = page + '-' + grid + '-w-' + idx;
107
- localStorage.setItem(key, width);
108
- const cat = localStorage.getItem(key);
109
- console.log(key);
125
+ const col_model = jQuery(this).jqGrid ('getGridParam', 'colModel');
126
+ if(col_model[index])
127
+ {
128
+ if(col_model[index]['name'])
129
+ {
130
+ const name = col_model[index]['name'];
131
+ const page = _page ? _page : localStorage.getItem('page');
132
+ const grid = this.id;
133
+ let key = page + '-' + grid + '-w-' + name;
134
+ localStorage.setItem(key, width);
135
+ const cat = localStorage.getItem(key);
136
+ }
137
+ }
110
138
  }
111
139
 
112
140
 
@@ -264,7 +292,7 @@ async hide_del_icon()
264
292
  /**
265
293
  @alias module:Vanilla_website_utils
266
294
  @example
267
- // example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
295
+ * example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
268
296
  */
269
297
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
270
298
  {
@@ -336,7 +364,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
336
364
  /**
337
365
  @alias module:Vanilla_website_utils
338
366
  @example
339
- // col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
367
+ * col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
340
368
  */
341
369
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
342
370
  {
@@ -425,8 +453,9 @@ __cell_format(cell_value, format)
425
453
  @alias module:Vanilla_website_utils
426
454
  @param {string} - row_id
427
455
  @param {string} - data id
456
+ @param {string} - url to request
428
457
  @param {object} - col_model for the table
429
- @param {string} - Caption
458
+ @param {string} - Add to the caption of the subgrid
430
459
  @example
431
460
  * let data_url = api + '/phone_detail?f=data&_id=';
432
461
  * let col_model_url = api + '/phone_detail?f=col_model';
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.2.3"
32
+ "version": "1.2.6"
33
33
  }