jqgrid_utils 1.2.14 → 1.2.17

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,7 +36,7 @@ A module for Jqgrid_utils
36
36
 
37
37
 
38
38
  * [Jqgrid_utils](#module_Jqgrid_utils)
39
- * [module.exports#set_link()](#exp_module_Jqgrid_utils--module.exports+set_link) ⏏
39
+ * [module.exports#set_link(col_model, edit_field, url)](#exp_module_Jqgrid_utils--module.exports+set_link) ⇒ <code>string</code>
40
40
  * [module.exports#grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+grid_set_caption) ⏏
41
41
  * [module.exports#s_resize_saved_cell_width()](#exp_module_Jqgrid_utils--module.exports+s_resize_saved_cell_width) ⏏
42
42
  * [module.exports#resize_saved_cell_width(col_model, page, grid)](#exp_module_Jqgrid_utils--module.exports+resize_saved_cell_width) ⏏
@@ -59,8 +59,22 @@ A module for Jqgrid_utils
59
59
 
60
60
  <a name="exp_module_Jqgrid_utils--module.exports+set_link"></a>
61
61
 
62
- ### module.exports#set\_link() ⏏
62
+ ### module.exports#set\_link(col_model, edit_field, url) ⇒ <code>string</code>
63
+ Add an URL from the data to a specific cell/column
64
+
63
65
  **Kind**: Exported function
66
+ **Returns**: <code>string</code> - https://foo.bar.com/av0_code/bar
67
+
68
+ | Param | Type | Description |
69
+ | --- | --- | --- |
70
+ | col_model | <code>object</code> | col_model of the grid |
71
+ | edit_field | <code>string</code> | name of the column what should get convert to the url |
72
+ | url | <code>string</code> | the used url of the data |
73
+
74
+ **Example**
75
+ ```js
76
+ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
77
+ ```
64
78
  <a name="exp_module_Jqgrid_utils--module.exports+grid_set_caption"></a>
65
79
 
66
80
  ### module.exports#grid\_set\_caption(_grid, data) ⏏
@@ -28,7 +28,15 @@ module.exports = class Vanilla_website_utils
28
28
  }
29
29
 
30
30
  /**
31
+ * Add an URL from the data to a specific cell/column
31
32
  @alias module:Jqgrid_utils
33
+ @param {object} - col_model of the grid
34
+ @param {string} - name of the column what should get convert to the url
35
+ @param {string} - the used url of the data
36
+ @returns {string} https://foo.bar.com/av0_code/bar
37
+ @example
38
+ var jqu = new Jqgrid_utils();
39
+ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
32
40
  */
33
41
  async set_link(col_model, edit_field, url ,attr='')
34
42
  {
@@ -45,6 +53,16 @@ module.exports = class Vanilla_website_utils
45
53
  return col_model;
46
54
  }
47
55
 
56
+ /**
57
+ @alias module:Jqgrid_utils
58
+ @param {object} - gridobject;
59
+ @param {object} - grid data (optional);
60
+ @example
61
+ var jqu = new Jqgrid_utils();
62
+ loadComplete: function(){
63
+ jqu.grid_set_caption(this);
64
+ },
65
+ */
48
66
 
49
67
  s_grid_set_caption(_grid, data=[])
50
68
  {
@@ -58,7 +76,7 @@ module.exports = class Vanilla_website_utils
58
76
  @example
59
77
  var jqu = new Jqgrid_utils();
60
78
  loadComplete: function(){
61
- jqu.grid_set_caption(this);
79
+ await jqu.grid_set_caption(this);
62
80
  },
63
81
  */
64
82
  async grid_set_caption(_grid, data=[])
@@ -81,6 +99,11 @@ loadComplete: function(){
81
99
 
82
100
  /**
83
101
  @alias module:Jqgrid_utils
102
+ @param {object} - the col_model of the grid
103
+ @param {string} - the name of the page(optional)
104
+ @param {object} - the grid objec(optional)
105
+ @example
106
+ col_model = await jqu.resize_saved_cell_width(col_model);
84
107
  */
85
108
  s_resize_saved_cell_width(col_model, page=false, grid=false)
86
109
  {
@@ -147,7 +170,19 @@ col_model = await jqu.resize_saved_cell_width(col_model);
147
170
 
148
171
 
149
172
  /**
173
+ * Upsert(insert or update) from the grid to an API
150
174
  @alias module:Jqgrid_utils
175
+ @param {object} - row object
176
+ @param {string} - url of the API
177
+ @param {string} - data oject
178
+ @returns {object} {update: 'ok'} or {udpate: 'failed'}
179
+ @example
180
+ var jqu = new Jqgrid_utils();
181
+ afterSetRow: async function(row)
182
+ {
183
+ let r = await jqu.upsert_row(row, url);
184
+ console.log(r);
185
+ },
151
186
  */
152
187
  async upsert_row(row, url, req = {})
153
188
  {
@@ -163,8 +198,21 @@ async upsert_row(row, url, req = {})
163
198
  }
164
199
  }
165
200
 
201
+
166
202
  /**
203
+ * Insert from the grid to an API used by the upsert_row function
167
204
  @alias module:Jqgrid_utils
205
+ @param {object} - row object
206
+ @param {string} - url of the API
207
+ @param {string} - data oject
208
+ @returns {object} Object from the the API like {update: 'ok'} or {update: 'failed'}
209
+ @example
210
+ var jqu = new Jqgrid_utils();
211
+ afterSetRow: async function(row)
212
+ {
213
+ let r = await jqu.upsert_row(row, url);
214
+ console.log(r);
215
+ },
168
216
  */
169
217
  async insert_row(row, url)
170
218
  {
@@ -188,8 +236,21 @@ async insert_row(row, url)
188
236
 
189
237
 
190
238
  /**
239
+ * Update from the grid to an API used by the upsert_row function
191
240
  @alias module:Jqgrid_utils
241
+ @param {object} - row object
242
+ @param {string} - url of the API
243
+ @param {string} - data oject
244
+ @returns {object} Object from the the API like {update: 'ok'} or {update: 'failed'}
245
+ @example
246
+ var jqu = new Jqgrid_utils();
247
+ afterSetRow: async function(row)
248
+ {
249
+ let r = await jqu.upsert_row(row, url);
250
+ console.log(r);
251
+ },
192
252
  */
253
+
193
254
  async update_row(row, url, req = {})
194
255
  {
195
256
  let ret = '';
@@ -211,8 +272,20 @@ async update_row(row, url, req = {})
211
272
  }
212
273
 
213
274
  /**
275
+ * Delete from the grid to an API
214
276
  @alias module:Jqgrid_utils
277
+ @param {string} - row id
278
+ @param {string} - url of the API
279
+ @returns {object} @returns {object} Object from the the API like {delete: 'ok'} or {delete: 'failed'}
280
+ @example
281
+ var jqu = new Jqgrid_utils();
282
+ afterDelRow: async function(row)
283
+ {
284
+ const r = await jqu.delete_row(row, url);
285
+ console.log(r + ' : ' + row + ' - from API');
286
+ },
215
287
  */
288
+
216
289
  async delete_row(_id, url)
217
290
  {
218
291
  let ret = '';
@@ -231,8 +304,18 @@ async delete_row(_id, url)
231
304
 
232
305
 
233
306
  /**
307
+ * Async Delete request used by function delete_row
234
308
  @alias module:Jqgrid_utils
309
+ @param {string} - url of the API
310
+ @returns {object} @returns {object} Object from the the API like {delete: 'ok'} or {delete: 'failed'}
311
+ @example
312
+ var jqu = new Jqgrid_utils();
313
+ afterDelRow: async function(row)
314
+ {
315
+ ret = JSON.parse(await jqu.adelete_api(url));
316
+ },
235
317
  */
318
+
236
319
  async adelete_api(url, json = false)
237
320
  {
238
321
  const ctype = json ? "application/json;charset=UTF-8" : "application/x-www-form-urlencoded";
@@ -248,9 +331,18 @@ async adelete_api(url, json = false)
248
331
  }
249
332
 
250
333
 
334
+
251
335
  /**
336
+ * Async Post request used by the update_row function
252
337
  @alias module:Jqgrid_utils
338
+ @param {string} - url of the API
339
+ @param {object} - json object
340
+ @returns {object} @returns {object} Object from the the API like {update: 'ok'} or {update: 'failed'}
341
+ @example
342
+ var jqu = new Jqgrid_utils();
343
+ ret = JSON.parse(await jqu.post_json(url,{'key':value,'key2':'value'}));
253
344
  */
345
+
254
346
  async post_json(url, data)
255
347
  {
256
348
  return new Promise((resolve, reject) =>
@@ -265,7 +357,14 @@ async post_json(url, data)
265
357
  }
266
358
 
267
359
  /**
360
+ * Async Put request used by the insert_row function
268
361
  @alias module:Jqgrid_utils
362
+ @param {string} - url of the API
363
+ @param {object} - json object
364
+ @returns {object} @returns {object} Object from the the API like {insert: 'ok'} or {insert: 'failed'}
365
+ @example
366
+ var jqu = new Jqgrid_utils();
367
+ ret = JSON.parse(await jqu.put_json(url,{'key':value,'key2':'value2'}));
269
368
  */
270
369
  async put_json(url, data)
271
370
  {
@@ -280,14 +379,24 @@ async put_json(url, data)
280
379
  });
281
380
  }
282
381
 
283
-
382
+ /**
383
+ * Hide the del iconf rom the grid
384
+ @alias module:Jqgrid_utils
385
+ @example
386
+ var jqu = new Jqgrid_utils();
387
+ jqu.hide_del_icon();
388
+ */
284
389
  s_hide_del_icon()
285
390
  {
286
391
  hide_del_icon();
287
392
  }
288
393
 
289
394
  /**
395
+ * Hide the del iconf rom the grid
290
396
  @alias module:Jqgrid_utils
397
+ @example
398
+ var jqu = new Jqgrid_utils();
399
+ await jqu.hide_del_icon();
291
400
  */
292
401
  async hide_del_icon()
293
402
  {
@@ -297,9 +406,16 @@ async hide_del_icon()
297
406
 
298
407
 
299
408
  /**
409
+ * Convert a cell into a link/url with data from another cell
300
410
  @alias module:Jqgrid_utils
411
+ @param {object} - col_model of the grid
412
+ @param {string} - URL string
413
+ @param {string} - Column/Cell to use
414
+ @param {string} - URL Attributes
415
+ @param {object} - keys and fields value to use
301
416
  @example
302
- * example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
417
+ var jqu = new Jqgrid_utils();
418
+ col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
303
419
  */
304
420
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
305
421
  {
@@ -369,9 +485,16 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
369
485
 
370
486
 
371
487
  /**
488
+ * Convert a cell into seperated based link/url like https://foo.bar.com/field/value/field/value
372
489
  @alias module:Jqgrid_utils
490
+ @param {object} - col_model of the grid
491
+ @param {string} - URL string
492
+ @param {string} - Column/Cell to use
493
+ @param {string} - URL Attributes
494
+ @param {object} - keys and fields value to use
373
495
  @example
374
- * col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
496
+ var jqu = new Jqgrid_utils();
497
+ col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
375
498
  */
376
499
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
377
500
  {
@@ -436,6 +559,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
436
559
 
437
560
 
438
561
  /**
562
+ * Private Function
439
563
  @alias module:Jqgrid_utils
440
564
  */
441
565
  __cell_format(cell_value, format)
package/jqgrid_utils.js CHANGED
@@ -27,7 +27,15 @@ module.exports = class Vanilla_website_utils
27
27
  }
28
28
 
29
29
  /**
30
+ * Add an URL from the data to a specific cell/column
30
31
  @alias module:Jqgrid_utils
32
+ @param {object} - col_model of the grid
33
+ @param {string} - name of the column what should get convert to the url
34
+ @param {string} - the used url of the data
35
+ @returns {string} https://foo.bar.com/av0_code/bar
36
+ @example
37
+ var jqu = new Jqgrid_utils();
38
+ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
31
39
  */
32
40
  async set_link(col_model, edit_field, url ,attr='')
33
41
  {
@@ -44,6 +52,16 @@ module.exports = class Vanilla_website_utils
44
52
  return col_model;
45
53
  }
46
54
 
55
+ /**
56
+ @alias module:Jqgrid_utils
57
+ @param {object} - gridobject;
58
+ @param {object} - grid data (optional);
59
+ @example
60
+ var jqu = new Jqgrid_utils();
61
+ loadComplete: function(){
62
+ jqu.grid_set_caption(this);
63
+ },
64
+ */
47
65
 
48
66
  s_grid_set_caption(_grid, data=[])
49
67
  {
@@ -57,7 +75,7 @@ module.exports = class Vanilla_website_utils
57
75
  @example
58
76
  var jqu = new Jqgrid_utils();
59
77
  loadComplete: function(){
60
- jqu.grid_set_caption(this);
78
+ await jqu.grid_set_caption(this);
61
79
  },
62
80
  */
63
81
  async grid_set_caption(_grid, data=[])
@@ -80,6 +98,11 @@ loadComplete: function(){
80
98
 
81
99
  /**
82
100
  @alias module:Jqgrid_utils
101
+ @param {object} - the col_model of the grid
102
+ @param {string} - the name of the page(optional)
103
+ @param {object} - the grid objec(optional)
104
+ @example
105
+ col_model = await jqu.resize_saved_cell_width(col_model);
83
106
  */
84
107
  s_resize_saved_cell_width(col_model, page=false, grid=false)
85
108
  {
@@ -146,7 +169,19 @@ col_model = await jqu.resize_saved_cell_width(col_model);
146
169
 
147
170
 
148
171
  /**
172
+ * Upsert(insert or update) from the grid to an API
149
173
  @alias module:Jqgrid_utils
174
+ @param {object} - row object
175
+ @param {string} - url of the API
176
+ @param {string} - data oject
177
+ @returns {object} {update: 'ok'} or {udpate: 'failed'}
178
+ @example
179
+ var jqu = new Jqgrid_utils();
180
+ afterSetRow: async function(row)
181
+ {
182
+ let r = await jqu.upsert_row(row, url);
183
+ console.log(r);
184
+ },
150
185
  */
151
186
  async upsert_row(row, url, req = {})
152
187
  {
@@ -162,8 +197,21 @@ async upsert_row(row, url, req = {})
162
197
  }
163
198
  }
164
199
 
200
+
165
201
  /**
202
+ * Insert from the grid to an API used by the upsert_row function
166
203
  @alias module:Jqgrid_utils
204
+ @param {object} - row object
205
+ @param {string} - url of the API
206
+ @param {string} - data oject
207
+ @returns {object} Object from the the API like {update: 'ok'} or {update: 'failed'}
208
+ @example
209
+ var jqu = new Jqgrid_utils();
210
+ afterSetRow: async function(row)
211
+ {
212
+ let r = await jqu.upsert_row(row, url);
213
+ console.log(r);
214
+ },
167
215
  */
168
216
  async insert_row(row, url)
169
217
  {
@@ -187,8 +235,21 @@ async insert_row(row, url)
187
235
 
188
236
 
189
237
  /**
238
+ * Update from the grid to an API used by the upsert_row function
190
239
  @alias module:Jqgrid_utils
240
+ @param {object} - row object
241
+ @param {string} - url of the API
242
+ @param {string} - data oject
243
+ @returns {object} Object from the the API like {update: 'ok'} or {update: 'failed'}
244
+ @example
245
+ var jqu = new Jqgrid_utils();
246
+ afterSetRow: async function(row)
247
+ {
248
+ let r = await jqu.upsert_row(row, url);
249
+ console.log(r);
250
+ },
191
251
  */
252
+
192
253
  async update_row(row, url, req = {})
193
254
  {
194
255
  let ret = '';
@@ -210,8 +271,20 @@ async update_row(row, url, req = {})
210
271
  }
211
272
 
212
273
  /**
274
+ * Delete from the grid to an API
213
275
  @alias module:Jqgrid_utils
276
+ @param {string} - row id
277
+ @param {string} - url of the API
278
+ @returns {object} @returns {object} Object from the the API like {delete: 'ok'} or {delete: 'failed'}
279
+ @example
280
+ var jqu = new Jqgrid_utils();
281
+ afterDelRow: async function(row)
282
+ {
283
+ const r = await jqu.delete_row(row, url);
284
+ console.log(r + ' : ' + row + ' - from API');
285
+ },
214
286
  */
287
+
215
288
  async delete_row(_id, url)
216
289
  {
217
290
  let ret = '';
@@ -230,8 +303,18 @@ async delete_row(_id, url)
230
303
 
231
304
 
232
305
  /**
306
+ * Async Delete request used by function delete_row
233
307
  @alias module:Jqgrid_utils
308
+ @param {string} - url of the API
309
+ @returns {object} @returns {object} Object from the the API like {delete: 'ok'} or {delete: 'failed'}
310
+ @example
311
+ var jqu = new Jqgrid_utils();
312
+ afterDelRow: async function(row)
313
+ {
314
+ ret = JSON.parse(await jqu.adelete_api(url));
315
+ },
234
316
  */
317
+
235
318
  async adelete_api(url, json = false)
236
319
  {
237
320
  const ctype = json ? "application/json;charset=UTF-8" : "application/x-www-form-urlencoded";
@@ -247,9 +330,18 @@ async adelete_api(url, json = false)
247
330
  }
248
331
 
249
332
 
333
+
250
334
  /**
335
+ * Async Post request used by the update_row function
251
336
  @alias module:Jqgrid_utils
337
+ @param {string} - url of the API
338
+ @param {object} - json object
339
+ @returns {object} @returns {object} Object from the the API like {update: 'ok'} or {update: 'failed'}
340
+ @example
341
+ var jqu = new Jqgrid_utils();
342
+ ret = JSON.parse(await jqu.post_json(url,{'key':value,'key2':'value'}));
252
343
  */
344
+
253
345
  async post_json(url, data)
254
346
  {
255
347
  return new Promise((resolve, reject) =>
@@ -264,7 +356,14 @@ async post_json(url, data)
264
356
  }
265
357
 
266
358
  /**
359
+ * Async Put request used by the insert_row function
267
360
  @alias module:Jqgrid_utils
361
+ @param {string} - url of the API
362
+ @param {object} - json object
363
+ @returns {object} @returns {object} Object from the the API like {insert: 'ok'} or {insert: 'failed'}
364
+ @example
365
+ var jqu = new Jqgrid_utils();
366
+ ret = JSON.parse(await jqu.put_json(url,{'key':value,'key2':'value2'}));
268
367
  */
269
368
  async put_json(url, data)
270
369
  {
@@ -279,14 +378,24 @@ async put_json(url, data)
279
378
  });
280
379
  }
281
380
 
282
-
381
+ /**
382
+ * Hide the del iconf rom the grid
383
+ @alias module:Jqgrid_utils
384
+ @example
385
+ var jqu = new Jqgrid_utils();
386
+ jqu.hide_del_icon();
387
+ */
283
388
  s_hide_del_icon()
284
389
  {
285
390
  hide_del_icon();
286
391
  }
287
392
 
288
393
  /**
394
+ * Hide the del iconf rom the grid
289
395
  @alias module:Jqgrid_utils
396
+ @example
397
+ var jqu = new Jqgrid_utils();
398
+ await jqu.hide_del_icon();
290
399
  */
291
400
  async hide_del_icon()
292
401
  {
@@ -296,9 +405,16 @@ async hide_del_icon()
296
405
 
297
406
 
298
407
  /**
408
+ * Convert a cell into a link/url with data from another cell
299
409
  @alias module:Jqgrid_utils
410
+ @param {object} - col_model of the grid
411
+ @param {string} - URL string
412
+ @param {string} - Column/Cell to use
413
+ @param {string} - URL Attributes
414
+ @param {object} - keys and fields value to use
300
415
  @example
301
- * example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
416
+ var jqu = new Jqgrid_utils();
417
+ col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
302
418
  */
303
419
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
304
420
  {
@@ -368,9 +484,16 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
368
484
 
369
485
 
370
486
  /**
487
+ * Convert a cell into seperated based link/url like https://foo.bar.com/field/value/field/value
371
488
  @alias module:Jqgrid_utils
489
+ @param {object} - col_model of the grid
490
+ @param {string} - URL string
491
+ @param {string} - Column/Cell to use
492
+ @param {string} - URL Attributes
493
+ @param {object} - keys and fields value to use
372
494
  @example
373
- * col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
495
+ var jqu = new Jqgrid_utils();
496
+ col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
374
497
  */
375
498
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
376
499
  {
@@ -435,6 +558,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
435
558
 
436
559
 
437
560
  /**
561
+ * Private Function
438
562
  @alias module:Jqgrid_utils
439
563
  */
440
564
  __cell_format(cell_value, format)
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.14"
32
+ "version": "1.2.17"
33
33
  }