jqgrid_utils 1.2.5 → 1.2.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 +49 -48
- package/dist/jqgrid_utils.js +52 -34
- package/jqgrid_utils.js +52 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,116 +54,117 @@ Discover All Functions:
|
|
|
54
54
|
},
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
<a name="
|
|
58
|
-
|
|
59
|
-
##
|
|
60
|
-
A module for
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* [
|
|
64
|
-
* [module.exports#set_link()](#
|
|
65
|
-
* [module.exports#grid_set_captain()](#
|
|
66
|
-
* [module.exports#resize_saved_cell_width(col_model, page, grid)](#
|
|
67
|
-
* [module.exports#upsert_row()](#
|
|
68
|
-
* [module.exports#insert_row()](#
|
|
69
|
-
* [module.exports#update_row()](#
|
|
70
|
-
* [module.exports#delete_row()](#
|
|
71
|
-
* [module.exports#adelete_api()](#
|
|
72
|
-
* [module.exports#post_json()](#
|
|
73
|
-
* [module.exports#put_json()](#
|
|
74
|
-
* [module.exports#hide_del_icon()](#
|
|
75
|
-
* [module.exports#add_link_details()](#
|
|
76
|
-
* [module.exports#add_link_details_separator()](#
|
|
77
|
-
* [module.exports#__cell_format()](#
|
|
78
|
-
* [module.exports#subgrid(_id, id, data_url, col_model)](#
|
|
79
|
-
* [module.exports#add_image(col_model, edit_field, size, link)](#
|
|
80
|
-
|
|
81
|
-
<a name="
|
|
57
|
+
<a name="module_Jqgrid_utils"></a>
|
|
58
|
+
|
|
59
|
+
## Jqgrid\_utils
|
|
60
|
+
A module for Jqgrid_utils
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
* [Jqgrid_utils](#module_Jqgrid_utils)
|
|
64
|
+
* [module.exports#set_link()](#exp_module_Jqgrid_utils--module.exports+set_link) ⏏
|
|
65
|
+
* [module.exports#grid_set_captain()](#exp_module_Jqgrid_utils--module.exports+grid_set_captain) ⏏
|
|
66
|
+
* [module.exports#resize_saved_cell_width(col_model, page, grid)](#exp_module_Jqgrid_utils--module.exports+resize_saved_cell_width) ⏏
|
|
67
|
+
* [module.exports#upsert_row()](#exp_module_Jqgrid_utils--module.exports+upsert_row) ⏏
|
|
68
|
+
* [module.exports#insert_row()](#exp_module_Jqgrid_utils--module.exports+insert_row) ⏏
|
|
69
|
+
* [module.exports#update_row()](#exp_module_Jqgrid_utils--module.exports+update_row) ⏏
|
|
70
|
+
* [module.exports#delete_row()](#exp_module_Jqgrid_utils--module.exports+delete_row) ⏏
|
|
71
|
+
* [module.exports#adelete_api()](#exp_module_Jqgrid_utils--module.exports+adelete_api) ⏏
|
|
72
|
+
* [module.exports#post_json()](#exp_module_Jqgrid_utils--module.exports+post_json) ⏏
|
|
73
|
+
* [module.exports#put_json()](#exp_module_Jqgrid_utils--module.exports+put_json) ⏏
|
|
74
|
+
* [module.exports#hide_del_icon()](#exp_module_Jqgrid_utils--module.exports+hide_del_icon) ⏏
|
|
75
|
+
* [module.exports#add_link_details()](#exp_module_Jqgrid_utils--module.exports+add_link_details) ⏏
|
|
76
|
+
* [module.exports#add_link_details_separator()](#exp_module_Jqgrid_utils--module.exports+add_link_details_separator) ⏏
|
|
77
|
+
* [module.exports#__cell_format()](#exp_module_Jqgrid_utils--module.exports+__cell_format) ⏏
|
|
78
|
+
* [module.exports#subgrid(_id, id, data_url, col_model, caption)](#exp_module_Jqgrid_utils--module.exports+subgrid) ⏏
|
|
79
|
+
* [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Jqgrid_utils--module.exports+add_image) ⏏
|
|
80
|
+
|
|
81
|
+
<a name="exp_module_Jqgrid_utils--module.exports+set_link"></a>
|
|
82
82
|
|
|
83
83
|
### module.exports#set\_link() ⏏
|
|
84
84
|
**Kind**: Exported function
|
|
85
|
-
<a name="
|
|
85
|
+
<a name="exp_module_Jqgrid_utils--module.exports+grid_set_captain"></a>
|
|
86
86
|
|
|
87
87
|
### module.exports#grid\_set\_captain() ⏏
|
|
88
88
|
**Kind**: Exported function
|
|
89
|
-
<a name="
|
|
89
|
+
<a name="exp_module_Jqgrid_utils--module.exports+resize_saved_cell_width"></a>
|
|
90
90
|
|
|
91
91
|
### module.exports#resize\_saved\_cell\_width(col_model, page, grid) ⏏
|
|
92
92
|
**Kind**: Exported function
|
|
93
93
|
|
|
94
94
|
| Param | Type | Default | Description |
|
|
95
95
|
| --- | --- | --- | --- |
|
|
96
|
-
| col_model | <code>object</code> | | col_model
|
|
97
|
-
| page | <code>string</code> | <code>false</code> | page |
|
|
98
|
-
| grid | <code>object</code> | <code>false</code> | grid |
|
|
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
99
|
|
|
100
100
|
**Example**
|
|
101
101
|
```js
|
|
102
102
|
col_model = await jqu.resize_saved_cell_width(col_model);
|
|
103
103
|
```
|
|
104
|
-
<a name="
|
|
104
|
+
<a name="exp_module_Jqgrid_utils--module.exports+upsert_row"></a>
|
|
105
105
|
|
|
106
106
|
### module.exports#upsert\_row() ⏏
|
|
107
107
|
**Kind**: Exported function
|
|
108
|
-
<a name="
|
|
108
|
+
<a name="exp_module_Jqgrid_utils--module.exports+insert_row"></a>
|
|
109
109
|
|
|
110
110
|
### module.exports#insert\_row() ⏏
|
|
111
111
|
**Kind**: Exported function
|
|
112
|
-
<a name="
|
|
112
|
+
<a name="exp_module_Jqgrid_utils--module.exports+update_row"></a>
|
|
113
113
|
|
|
114
114
|
### module.exports#update\_row() ⏏
|
|
115
115
|
**Kind**: Exported function
|
|
116
|
-
<a name="
|
|
116
|
+
<a name="exp_module_Jqgrid_utils--module.exports+delete_row"></a>
|
|
117
117
|
|
|
118
118
|
### module.exports#delete\_row() ⏏
|
|
119
119
|
**Kind**: Exported function
|
|
120
|
-
<a name="
|
|
120
|
+
<a name="exp_module_Jqgrid_utils--module.exports+adelete_api"></a>
|
|
121
121
|
|
|
122
122
|
### module.exports#adelete\_api() ⏏
|
|
123
123
|
**Kind**: Exported function
|
|
124
|
-
<a name="
|
|
124
|
+
<a name="exp_module_Jqgrid_utils--module.exports+post_json"></a>
|
|
125
125
|
|
|
126
126
|
### module.exports#post\_json() ⏏
|
|
127
127
|
**Kind**: Exported function
|
|
128
|
-
<a name="
|
|
128
|
+
<a name="exp_module_Jqgrid_utils--module.exports+put_json"></a>
|
|
129
129
|
|
|
130
130
|
### module.exports#put\_json() ⏏
|
|
131
131
|
**Kind**: Exported function
|
|
132
|
-
<a name="
|
|
132
|
+
<a name="exp_module_Jqgrid_utils--module.exports+hide_del_icon"></a>
|
|
133
133
|
|
|
134
134
|
### module.exports#hide\_del\_icon() ⏏
|
|
135
135
|
**Kind**: Exported function
|
|
136
|
-
<a name="
|
|
136
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_link_details"></a>
|
|
137
137
|
|
|
138
138
|
### module.exports#add\_link\_details() ⏏
|
|
139
139
|
**Kind**: Exported function
|
|
140
140
|
**Example**
|
|
141
141
|
```js
|
|
142
|
-
|
|
142
|
+
example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
|
|
143
143
|
```
|
|
144
|
-
<a name="
|
|
144
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_link_details_separator"></a>
|
|
145
145
|
|
|
146
146
|
### module.exports#add\_link\_details\_separator() ⏏
|
|
147
147
|
**Kind**: Exported function
|
|
148
148
|
**Example**
|
|
149
149
|
```js
|
|
150
|
-
|
|
150
|
+
col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
|
|
151
151
|
```
|
|
152
|
-
<a name="
|
|
152
|
+
<a name="exp_module_Jqgrid_utils--module.exports+__cell_format"></a>
|
|
153
153
|
|
|
154
154
|
### module.exports#\_\_cell\_format() ⏏
|
|
155
155
|
**Kind**: Exported function
|
|
156
|
-
<a name="
|
|
156
|
+
<a name="exp_module_Jqgrid_utils--module.exports+subgrid"></a>
|
|
157
157
|
|
|
158
|
-
### module.exports#subgrid(_id, id, data_url, col_model) ⏏
|
|
158
|
+
### module.exports#subgrid(_id, id, data_url, col_model, caption) ⏏
|
|
159
159
|
**Kind**: Exported function
|
|
160
160
|
|
|
161
161
|
| Param | Type | Description |
|
|
162
162
|
| --- | --- | --- |
|
|
163
163
|
| _id | <code>string</code> | row_id |
|
|
164
164
|
| id | <code>string</code> | data id |
|
|
165
|
-
| data_url | <code>
|
|
166
|
-
| col_model | <code>
|
|
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 |
|
|
167
168
|
|
|
168
169
|
**Example**
|
|
169
170
|
```js
|
|
@@ -171,7 +172,7 @@ let data_url = api + '/phone_detail?f=data&_id=';
|
|
|
171
172
|
let col_model_url = api + '/phone_detail?f=col_model';
|
|
172
173
|
let col_model = JSON.parse(await vwu.aget_api(col_model_url))
|
|
173
174
|
```
|
|
174
|
-
<a name="
|
|
175
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_image"></a>
|
|
175
176
|
|
|
176
177
|
### module.exports#add\_image(col_model, edit_field, size, link) ⏏
|
|
177
178
|
**Kind**: Exported function
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Jqgrid_utils = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
2
|
/**
|
|
3
|
-
* A module for
|
|
4
|
-
* @module
|
|
3
|
+
* A module for Jqgrid_utils
|
|
4
|
+
* @module Jqgrid_utils
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
@@ -28,7 +28,7 @@ module.exports = class Vanilla_website_utils
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
@alias module:
|
|
31
|
+
@alias module:Jqgrid_utils
|
|
32
32
|
*/
|
|
33
33
|
async set_link(col_model, edit_field, url ,attr='')
|
|
34
34
|
{
|
|
@@ -52,7 +52,7 @@ module.exports = class Vanilla_website_utils
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
@alias module:
|
|
55
|
+
@alias module:Jqgrid_utils
|
|
56
56
|
*/
|
|
57
57
|
async grid_set_captain(_grid, data=[])
|
|
58
58
|
{
|
|
@@ -81,10 +81,10 @@ module.exports = class Vanilla_website_utils
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
@alias module:
|
|
85
|
-
@param {object} - col_model
|
|
86
|
-
@param {string} - page
|
|
87
|
-
@param {object} - grid
|
|
84
|
+
@alias module:Jqgrid_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
88
|
@example
|
|
89
89
|
* col_model = await jqu.resize_saved_cell_width(col_model);
|
|
90
90
|
*/
|
|
@@ -111,12 +111,12 @@ module.exports = class Vanilla_website_utils
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
@alias module:
|
|
114
|
+
@alias module:Jqgrid_utils
|
|
115
115
|
* resize_cell
|
|
116
116
|
* call after resize a column
|
|
117
|
-
@param {string}
|
|
118
|
-
@param {string}
|
|
119
|
-
@param {string}
|
|
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
120
|
@example
|
|
121
121
|
* var jqu = new Jqgrid_utils({page:'mypage'});
|
|
122
122
|
* resizeStop: jqu.resize_cell,
|
|
@@ -141,7 +141,7 @@ module.exports = class Vanilla_website_utils
|
|
|
141
141
|
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
@alias module:
|
|
144
|
+
@alias module:Jqgrid_utils
|
|
145
145
|
*/
|
|
146
146
|
async upsert_row(row, url, req = {})
|
|
147
147
|
{
|
|
@@ -158,7 +158,7 @@ async upsert_row(row, url, req = {})
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
@alias module:
|
|
161
|
+
@alias module:Jqgrid_utils
|
|
162
162
|
*/
|
|
163
163
|
async insert_row(row, url)
|
|
164
164
|
{
|
|
@@ -182,7 +182,7 @@ async insert_row(row, url)
|
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
@alias module:
|
|
185
|
+
@alias module:Jqgrid_utils
|
|
186
186
|
*/
|
|
187
187
|
async update_row(row, url, req = {})
|
|
188
188
|
{
|
|
@@ -205,7 +205,7 @@ async update_row(row, url, req = {})
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
|
-
@alias module:
|
|
208
|
+
@alias module:Jqgrid_utils
|
|
209
209
|
*/
|
|
210
210
|
async delete_row(_id, url)
|
|
211
211
|
{
|
|
@@ -225,7 +225,7 @@ async delete_row(_id, url)
|
|
|
225
225
|
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
|
-
@alias module:
|
|
228
|
+
@alias module:Jqgrid_utils
|
|
229
229
|
*/
|
|
230
230
|
async adelete_api(url, json = false)
|
|
231
231
|
{
|
|
@@ -243,7 +243,7 @@ async adelete_api(url, json = false)
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
|
-
@alias module:
|
|
246
|
+
@alias module:Jqgrid_utils
|
|
247
247
|
*/
|
|
248
248
|
async post_json(url, data)
|
|
249
249
|
{
|
|
@@ -259,7 +259,7 @@ async post_json(url, data)
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
|
-
@alias module:
|
|
262
|
+
@alias module:Jqgrid_utils
|
|
263
263
|
*/
|
|
264
264
|
async put_json(url, data)
|
|
265
265
|
{
|
|
@@ -281,7 +281,7 @@ s_hide_del_icon()
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
|
-
@alias module:
|
|
284
|
+
@alias module:Jqgrid_utils
|
|
285
285
|
*/
|
|
286
286
|
async hide_del_icon()
|
|
287
287
|
{
|
|
@@ -291,9 +291,9 @@ async hide_del_icon()
|
|
|
291
291
|
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
|
-
@alias module:
|
|
294
|
+
@alias module:Jqgrid_utils
|
|
295
295
|
@example
|
|
296
|
-
|
|
296
|
+
* example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
|
|
297
297
|
*/
|
|
298
298
|
async add_link_details(col_model, url, edit_field, attr = '', keys, format)
|
|
299
299
|
{
|
|
@@ -363,9 +363,9 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
|
|
|
363
363
|
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
|
-
@alias module:
|
|
366
|
+
@alias module:Jqgrid_utils
|
|
367
367
|
@example
|
|
368
|
-
|
|
368
|
+
* col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
|
|
369
369
|
*/
|
|
370
370
|
async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
|
|
371
371
|
{
|
|
@@ -430,7 +430,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
|
|
|
430
430
|
|
|
431
431
|
|
|
432
432
|
/**
|
|
433
|
-
@alias module:
|
|
433
|
+
@alias module:Jqgrid_utils
|
|
434
434
|
*/
|
|
435
435
|
__cell_format(cell_value, format)
|
|
436
436
|
{
|
|
@@ -451,11 +451,12 @@ __cell_format(cell_value, format)
|
|
|
451
451
|
|
|
452
452
|
|
|
453
453
|
/**
|
|
454
|
-
@alias module:
|
|
454
|
+
@alias module:Jqgrid_utils
|
|
455
455
|
@param {string} - row_id
|
|
456
456
|
@param {string} - data id
|
|
457
|
+
@param {string} - url to request
|
|
457
458
|
@param {object} - col_model for the table
|
|
458
|
-
@param {string} -
|
|
459
|
+
@param {string} - Add to the caption of the subgrid
|
|
459
460
|
@example
|
|
460
461
|
* let data_url = api + '/phone_detail?f=data&_id=';
|
|
461
462
|
* let col_model_url = api + '/phone_detail?f=col_model';
|
|
@@ -482,7 +483,7 @@ async subgrid(_id, id, data_url, col_model, caption='' )
|
|
|
482
483
|
|
|
483
484
|
|
|
484
485
|
/**
|
|
485
|
-
@alias module:
|
|
486
|
+
@alias module:Jqgrid_utils
|
|
486
487
|
@param {object} - col_model for the grid
|
|
487
488
|
@param {string} - field what include the image/picture href path like http://mypicture.png
|
|
488
489
|
@param {int} - size of the picture
|
|
@@ -505,14 +506,28 @@ async add_image(col_model, edit_field, size, link=false)
|
|
|
505
506
|
col_model[i]['height'] = size;
|
|
506
507
|
col_model[i]['formatter'] = function(cell_val)
|
|
507
508
|
{
|
|
508
|
-
|
|
509
|
+
const cell_val2 = cell_val.toLowerCase();
|
|
510
|
+
if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
|
|
509
511
|
{
|
|
510
|
-
|
|
512
|
+
if(cell_val2.endsWith(".png") ||
|
|
513
|
+
cell_val2.endsWith(".jpg") ||
|
|
514
|
+
cell_val2.endsWith(".jpeg") ||
|
|
515
|
+
cell_val2.endsWith(".gif") ||
|
|
516
|
+
cell_val2.endsWith(".svg") ||
|
|
517
|
+
cell_val2.endsWith(".svgz") ||
|
|
518
|
+
cell_val2.endsWith(".webp"))
|
|
519
|
+
{
|
|
520
|
+
if(link)
|
|
521
|
+
{
|
|
522
|
+
return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
|
|
523
|
+
}
|
|
524
|
+
else
|
|
525
|
+
{
|
|
526
|
+
return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
|
|
527
|
+
}
|
|
528
|
+
}
|
|
511
529
|
}
|
|
512
|
-
|
|
513
|
-
{
|
|
514
|
-
return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
|
|
515
|
-
}
|
|
530
|
+
return cell_val;
|
|
516
531
|
};
|
|
517
532
|
}
|
|
518
533
|
}
|
|
@@ -521,6 +536,9 @@ async add_image(col_model, edit_field, size, link=false)
|
|
|
521
536
|
|
|
522
537
|
|
|
523
538
|
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
524
542
|
};
|
|
525
543
|
|
|
526
544
|
|
package/jqgrid_utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A module for
|
|
3
|
-
* @module
|
|
2
|
+
* A module for Jqgrid_utils
|
|
3
|
+
* @module Jqgrid_utils
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -27,7 +27,7 @@ module.exports = class Vanilla_website_utils
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
@alias module:
|
|
30
|
+
@alias module:Jqgrid_utils
|
|
31
31
|
*/
|
|
32
32
|
async set_link(col_model, edit_field, url ,attr='')
|
|
33
33
|
{
|
|
@@ -51,7 +51,7 @@ module.exports = class Vanilla_website_utils
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
@alias module:
|
|
54
|
+
@alias module:Jqgrid_utils
|
|
55
55
|
*/
|
|
56
56
|
async grid_set_captain(_grid, data=[])
|
|
57
57
|
{
|
|
@@ -80,10 +80,10 @@ module.exports = class Vanilla_website_utils
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
@alias module:
|
|
84
|
-
@param {object} - col_model
|
|
85
|
-
@param {string} - page
|
|
86
|
-
@param {object} - grid
|
|
83
|
+
@alias module:Jqgrid_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
87
|
@example
|
|
88
88
|
* col_model = await jqu.resize_saved_cell_width(col_model);
|
|
89
89
|
*/
|
|
@@ -110,12 +110,12 @@ module.exports = class Vanilla_website_utils
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
@alias module:
|
|
113
|
+
@alias module:Jqgrid_utils
|
|
114
114
|
* resize_cell
|
|
115
115
|
* call after resize a column
|
|
116
|
-
@param {string}
|
|
117
|
-
@param {string}
|
|
118
|
-
@param {string}
|
|
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
119
|
@example
|
|
120
120
|
* var jqu = new Jqgrid_utils({page:'mypage'});
|
|
121
121
|
* resizeStop: jqu.resize_cell,
|
|
@@ -140,7 +140,7 @@ module.exports = class Vanilla_website_utils
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
@alias module:
|
|
143
|
+
@alias module:Jqgrid_utils
|
|
144
144
|
*/
|
|
145
145
|
async upsert_row(row, url, req = {})
|
|
146
146
|
{
|
|
@@ -157,7 +157,7 @@ async upsert_row(row, url, req = {})
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
|
-
@alias module:
|
|
160
|
+
@alias module:Jqgrid_utils
|
|
161
161
|
*/
|
|
162
162
|
async insert_row(row, url)
|
|
163
163
|
{
|
|
@@ -181,7 +181,7 @@ async insert_row(row, url)
|
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
|
-
@alias module:
|
|
184
|
+
@alias module:Jqgrid_utils
|
|
185
185
|
*/
|
|
186
186
|
async update_row(row, url, req = {})
|
|
187
187
|
{
|
|
@@ -204,7 +204,7 @@ async update_row(row, url, req = {})
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
@alias module:
|
|
207
|
+
@alias module:Jqgrid_utils
|
|
208
208
|
*/
|
|
209
209
|
async delete_row(_id, url)
|
|
210
210
|
{
|
|
@@ -224,7 +224,7 @@ async delete_row(_id, url)
|
|
|
224
224
|
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
@alias module:
|
|
227
|
+
@alias module:Jqgrid_utils
|
|
228
228
|
*/
|
|
229
229
|
async adelete_api(url, json = false)
|
|
230
230
|
{
|
|
@@ -242,7 +242,7 @@ async adelete_api(url, json = false)
|
|
|
242
242
|
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
|
-
@alias module:
|
|
245
|
+
@alias module:Jqgrid_utils
|
|
246
246
|
*/
|
|
247
247
|
async post_json(url, data)
|
|
248
248
|
{
|
|
@@ -258,7 +258,7 @@ async post_json(url, data)
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
/**
|
|
261
|
-
@alias module:
|
|
261
|
+
@alias module:Jqgrid_utils
|
|
262
262
|
*/
|
|
263
263
|
async put_json(url, data)
|
|
264
264
|
{
|
|
@@ -280,7 +280,7 @@ s_hide_del_icon()
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
/**
|
|
283
|
-
@alias module:
|
|
283
|
+
@alias module:Jqgrid_utils
|
|
284
284
|
*/
|
|
285
285
|
async hide_del_icon()
|
|
286
286
|
{
|
|
@@ -290,9 +290,9 @@ async hide_del_icon()
|
|
|
290
290
|
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
-
@alias module:
|
|
293
|
+
@alias module:Jqgrid_utils
|
|
294
294
|
@example
|
|
295
|
-
|
|
295
|
+
* example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
|
|
296
296
|
*/
|
|
297
297
|
async add_link_details(col_model, url, edit_field, attr = '', keys, format)
|
|
298
298
|
{
|
|
@@ -362,9 +362,9 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
|
|
|
362
362
|
|
|
363
363
|
|
|
364
364
|
/**
|
|
365
|
-
@alias module:
|
|
365
|
+
@alias module:Jqgrid_utils
|
|
366
366
|
@example
|
|
367
|
-
|
|
367
|
+
* col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
|
|
368
368
|
*/
|
|
369
369
|
async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
|
|
370
370
|
{
|
|
@@ -429,7 +429,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
|
|
|
429
429
|
|
|
430
430
|
|
|
431
431
|
/**
|
|
432
|
-
@alias module:
|
|
432
|
+
@alias module:Jqgrid_utils
|
|
433
433
|
*/
|
|
434
434
|
__cell_format(cell_value, format)
|
|
435
435
|
{
|
|
@@ -450,11 +450,12 @@ __cell_format(cell_value, format)
|
|
|
450
450
|
|
|
451
451
|
|
|
452
452
|
/**
|
|
453
|
-
@alias module:
|
|
453
|
+
@alias module:Jqgrid_utils
|
|
454
454
|
@param {string} - row_id
|
|
455
455
|
@param {string} - data id
|
|
456
|
+
@param {string} - url to request
|
|
456
457
|
@param {object} - col_model for the table
|
|
457
|
-
@param {string} -
|
|
458
|
+
@param {string} - Add to the caption of the subgrid
|
|
458
459
|
@example
|
|
459
460
|
* let data_url = api + '/phone_detail?f=data&_id=';
|
|
460
461
|
* let col_model_url = api + '/phone_detail?f=col_model';
|
|
@@ -481,7 +482,7 @@ async subgrid(_id, id, data_url, col_model, caption='' )
|
|
|
481
482
|
|
|
482
483
|
|
|
483
484
|
/**
|
|
484
|
-
@alias module:
|
|
485
|
+
@alias module:Jqgrid_utils
|
|
485
486
|
@param {object} - col_model for the grid
|
|
486
487
|
@param {string} - field what include the image/picture href path like http://mypicture.png
|
|
487
488
|
@param {int} - size of the picture
|
|
@@ -504,14 +505,28 @@ async add_image(col_model, edit_field, size, link=false)
|
|
|
504
505
|
col_model[i]['height'] = size;
|
|
505
506
|
col_model[i]['formatter'] = function(cell_val)
|
|
506
507
|
{
|
|
507
|
-
|
|
508
|
+
const cell_val2 = cell_val.toLowerCase();
|
|
509
|
+
if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
|
|
508
510
|
{
|
|
509
|
-
|
|
511
|
+
if(cell_val2.endsWith(".png") ||
|
|
512
|
+
cell_val2.endsWith(".jpg") ||
|
|
513
|
+
cell_val2.endsWith(".jpeg") ||
|
|
514
|
+
cell_val2.endsWith(".gif") ||
|
|
515
|
+
cell_val2.endsWith(".svg") ||
|
|
516
|
+
cell_val2.endsWith(".svgz") ||
|
|
517
|
+
cell_val2.endsWith(".webp"))
|
|
518
|
+
{
|
|
519
|
+
if(link)
|
|
520
|
+
{
|
|
521
|
+
return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
|
|
522
|
+
}
|
|
523
|
+
else
|
|
524
|
+
{
|
|
525
|
+
return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
|
|
526
|
+
}
|
|
527
|
+
}
|
|
510
528
|
}
|
|
511
|
-
|
|
512
|
-
{
|
|
513
|
-
return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
|
|
514
|
-
}
|
|
529
|
+
return cell_val;
|
|
515
530
|
};
|
|
516
531
|
}
|
|
517
532
|
}
|
|
@@ -520,6 +535,9 @@ async add_image(col_model, edit_field, size, link=false)
|
|
|
520
535
|
|
|
521
536
|
|
|
522
537
|
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
523
541
|
};
|
|
524
542
|
|
|
525
543
|
|
package/package.json
CHANGED