jqgrid_utils 1.2.16 → 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.
@@ -35,6 +35,7 @@ module.exports = class Vanilla_website_utils
35
35
  @param {string} - the used url of the data
36
36
  @returns {string} https://foo.bar.com/av0_code/bar
37
37
  @example
38
+ var jqu = new Jqgrid_utils();
38
39
  col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
39
40
  */
40
41
  async set_link(col_model, edit_field, url ,attr='')
@@ -52,6 +53,16 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
52
53
  return col_model;
53
54
  }
54
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
+ */
55
66
 
56
67
  s_grid_set_caption(_grid, data=[])
57
68
  {
@@ -65,7 +76,7 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
65
76
  @example
66
77
  var jqu = new Jqgrid_utils();
67
78
  loadComplete: function(){
68
- jqu.grid_set_caption(this);
79
+ await jqu.grid_set_caption(this);
69
80
  },
70
81
  */
71
82
  async grid_set_caption(_grid, data=[])
@@ -88,6 +99,11 @@ loadComplete: function(){
88
99
 
89
100
  /**
90
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);
91
107
  */
92
108
  s_resize_saved_cell_width(col_model, page=false, grid=false)
93
109
  {
@@ -154,7 +170,19 @@ col_model = await jqu.resize_saved_cell_width(col_model);
154
170
 
155
171
 
156
172
  /**
173
+ * Upsert(insert or update) from the grid to an API
157
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
+ },
158
186
  */
159
187
  async upsert_row(row, url, req = {})
160
188
  {
@@ -170,8 +198,21 @@ async upsert_row(row, url, req = {})
170
198
  }
171
199
  }
172
200
 
201
+
173
202
  /**
203
+ * Insert from the grid to an API used by the upsert_row function
174
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
+ },
175
216
  */
176
217
  async insert_row(row, url)
177
218
  {
@@ -195,8 +236,21 @@ async insert_row(row, url)
195
236
 
196
237
 
197
238
  /**
239
+ * Update from the grid to an API used by the upsert_row function
198
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
+ },
199
252
  */
253
+
200
254
  async update_row(row, url, req = {})
201
255
  {
202
256
  let ret = '';
@@ -218,8 +272,20 @@ async update_row(row, url, req = {})
218
272
  }
219
273
 
220
274
  /**
275
+ * Delete from the grid to an API
221
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
+ },
222
287
  */
288
+
223
289
  async delete_row(_id, url)
224
290
  {
225
291
  let ret = '';
@@ -238,8 +304,18 @@ async delete_row(_id, url)
238
304
 
239
305
 
240
306
  /**
307
+ * Async Delete request used by function delete_row
241
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
+ },
242
317
  */
318
+
243
319
  async adelete_api(url, json = false)
244
320
  {
245
321
  const ctype = json ? "application/json;charset=UTF-8" : "application/x-www-form-urlencoded";
@@ -255,9 +331,18 @@ async adelete_api(url, json = false)
255
331
  }
256
332
 
257
333
 
334
+
258
335
  /**
336
+ * Async Post request used by the update_row function
259
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'}));
260
344
  */
345
+
261
346
  async post_json(url, data)
262
347
  {
263
348
  return new Promise((resolve, reject) =>
@@ -272,7 +357,14 @@ async post_json(url, data)
272
357
  }
273
358
 
274
359
  /**
360
+ * Async Put request used by the insert_row function
275
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'}));
276
368
  */
277
369
  async put_json(url, data)
278
370
  {
@@ -287,14 +379,24 @@ async put_json(url, data)
287
379
  });
288
380
  }
289
381
 
290
-
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
+ */
291
389
  s_hide_del_icon()
292
390
  {
293
391
  hide_del_icon();
294
392
  }
295
393
 
296
394
  /**
395
+ * Hide the del iconf rom the grid
297
396
  @alias module:Jqgrid_utils
397
+ @example
398
+ var jqu = new Jqgrid_utils();
399
+ await jqu.hide_del_icon();
298
400
  */
299
401
  async hide_del_icon()
300
402
  {
@@ -304,9 +406,16 @@ async hide_del_icon()
304
406
 
305
407
 
306
408
  /**
409
+ * Convert a cell into a link/url with data from another cell
307
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
308
416
  @example
309
- * 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"});
310
419
  */
311
420
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
312
421
  {
@@ -376,9 +485,16 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
376
485
 
377
486
 
378
487
  /**
488
+ * Convert a cell into seperated based link/url like https://foo.bar.com/field/value/field/value
379
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
380
495
  @example
381
- * 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"});
382
498
  */
383
499
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
384
500
  {
@@ -443,6 +559,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
443
559
 
444
560
 
445
561
  /**
562
+ * Private Function
446
563
  @alias module:Jqgrid_utils
447
564
  */
448
565
  __cell_format(cell_value, format)
package/jqgrid_utils.js CHANGED
@@ -34,6 +34,7 @@ module.exports = class Vanilla_website_utils
34
34
  @param {string} - the used url of the data
35
35
  @returns {string} https://foo.bar.com/av0_code/bar
36
36
  @example
37
+ var jqu = new Jqgrid_utils();
37
38
  col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
38
39
  */
39
40
  async set_link(col_model, edit_field, url ,attr='')
@@ -51,6 +52,16 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
51
52
  return col_model;
52
53
  }
53
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
+ */
54
65
 
55
66
  s_grid_set_caption(_grid, data=[])
56
67
  {
@@ -64,7 +75,7 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
64
75
  @example
65
76
  var jqu = new Jqgrid_utils();
66
77
  loadComplete: function(){
67
- jqu.grid_set_caption(this);
78
+ await jqu.grid_set_caption(this);
68
79
  },
69
80
  */
70
81
  async grid_set_caption(_grid, data=[])
@@ -87,6 +98,11 @@ loadComplete: function(){
87
98
 
88
99
  /**
89
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);
90
106
  */
91
107
  s_resize_saved_cell_width(col_model, page=false, grid=false)
92
108
  {
@@ -153,7 +169,19 @@ col_model = await jqu.resize_saved_cell_width(col_model);
153
169
 
154
170
 
155
171
  /**
172
+ * Upsert(insert or update) from the grid to an API
156
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
+ },
157
185
  */
158
186
  async upsert_row(row, url, req = {})
159
187
  {
@@ -169,8 +197,21 @@ async upsert_row(row, url, req = {})
169
197
  }
170
198
  }
171
199
 
200
+
172
201
  /**
202
+ * Insert from the grid to an API used by the upsert_row function
173
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
+ },
174
215
  */
175
216
  async insert_row(row, url)
176
217
  {
@@ -194,8 +235,21 @@ async insert_row(row, url)
194
235
 
195
236
 
196
237
  /**
238
+ * Update from the grid to an API used by the upsert_row function
197
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
+ },
198
251
  */
252
+
199
253
  async update_row(row, url, req = {})
200
254
  {
201
255
  let ret = '';
@@ -217,8 +271,20 @@ async update_row(row, url, req = {})
217
271
  }
218
272
 
219
273
  /**
274
+ * Delete from the grid to an API
220
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
+ },
221
286
  */
287
+
222
288
  async delete_row(_id, url)
223
289
  {
224
290
  let ret = '';
@@ -237,8 +303,18 @@ async delete_row(_id, url)
237
303
 
238
304
 
239
305
  /**
306
+ * Async Delete request used by function delete_row
240
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
+ },
241
316
  */
317
+
242
318
  async adelete_api(url, json = false)
243
319
  {
244
320
  const ctype = json ? "application/json;charset=UTF-8" : "application/x-www-form-urlencoded";
@@ -254,9 +330,18 @@ async adelete_api(url, json = false)
254
330
  }
255
331
 
256
332
 
333
+
257
334
  /**
335
+ * Async Post request used by the update_row function
258
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'}));
259
343
  */
344
+
260
345
  async post_json(url, data)
261
346
  {
262
347
  return new Promise((resolve, reject) =>
@@ -271,7 +356,14 @@ async post_json(url, data)
271
356
  }
272
357
 
273
358
  /**
359
+ * Async Put request used by the insert_row function
274
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'}));
275
367
  */
276
368
  async put_json(url, data)
277
369
  {
@@ -286,14 +378,24 @@ async put_json(url, data)
286
378
  });
287
379
  }
288
380
 
289
-
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
+ */
290
388
  s_hide_del_icon()
291
389
  {
292
390
  hide_del_icon();
293
391
  }
294
392
 
295
393
  /**
394
+ * Hide the del iconf rom the grid
296
395
  @alias module:Jqgrid_utils
396
+ @example
397
+ var jqu = new Jqgrid_utils();
398
+ await jqu.hide_del_icon();
297
399
  */
298
400
  async hide_del_icon()
299
401
  {
@@ -303,9 +405,16 @@ async hide_del_icon()
303
405
 
304
406
 
305
407
  /**
408
+ * Convert a cell into a link/url with data from another cell
306
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
307
415
  @example
308
- * 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"});
309
418
  */
310
419
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
311
420
  {
@@ -375,9 +484,16 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
375
484
 
376
485
 
377
486
  /**
487
+ * Convert a cell into seperated based link/url like https://foo.bar.com/field/value/field/value
378
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
379
494
  @example
380
- * 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"});
381
497
  */
382
498
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
383
499
  {
@@ -442,6 +558,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
442
558
 
443
559
 
444
560
  /**
561
+ * Private Function
445
562
  @alias module:Jqgrid_utils
446
563
  */
447
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.16"
32
+ "version": "1.2.17"
33
33
  }