jqgrid_utils 1.2.17 → 1.2.18
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 +216 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,20 +37,22 @@ A module for Jqgrid_utils
|
|
|
37
37
|
|
|
38
38
|
* [Jqgrid_utils](#module_Jqgrid_utils)
|
|
39
39
|
* [module.exports#set_link(col_model, edit_field, url)](#exp_module_Jqgrid_utils--module.exports+set_link) ⇒ <code>string</code> ⏏
|
|
40
|
+
* [module.exports#s_grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+s_grid_set_caption) ⏏
|
|
40
41
|
* [module.exports#grid_set_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+grid_set_caption) ⏏
|
|
41
|
-
* [module.exports#s_resize_saved_cell_width()](#exp_module_Jqgrid_utils--module.exports+s_resize_saved_cell_width) ⏏
|
|
42
|
+
* [module.exports#s_resize_saved_cell_width(col_model, page, grid)](#exp_module_Jqgrid_utils--module.exports+s_resize_saved_cell_width) ⏏
|
|
42
43
|
* [module.exports#resize_saved_cell_width(col_model, page, grid)](#exp_module_Jqgrid_utils--module.exports+resize_saved_cell_width) ⏏
|
|
43
44
|
* [module.exports#resize_cell(the, column, not)](#exp_module_Jqgrid_utils--module.exports+resize_cell) ⏏
|
|
44
|
-
* [module.exports#upsert_row()](#exp_module_Jqgrid_utils--module.exports+upsert_row) ⏏
|
|
45
|
-
* [module.exports#insert_row()](#exp_module_Jqgrid_utils--module.exports+insert_row) ⏏
|
|
46
|
-
* [module.exports#update_row()](#exp_module_Jqgrid_utils--module.exports+update_row) ⏏
|
|
47
|
-
* [module.exports#delete_row()](#exp_module_Jqgrid_utils--module.exports+delete_row) ⏏
|
|
48
|
-
* [module.exports#adelete_api()](#exp_module_Jqgrid_utils--module.exports+adelete_api) ⏏
|
|
49
|
-
* [module.exports#post_json()](#exp_module_Jqgrid_utils--module.exports+post_json) ⏏
|
|
50
|
-
* [module.exports#put_json()](#exp_module_Jqgrid_utils--module.exports+put_json) ⏏
|
|
45
|
+
* [module.exports#upsert_row(row, url, req)](#exp_module_Jqgrid_utils--module.exports+upsert_row) ⇒ <code>object</code> ⏏
|
|
46
|
+
* [module.exports#insert_row(row, url)](#exp_module_Jqgrid_utils--module.exports+insert_row) ⇒ <code>object</code> ⏏
|
|
47
|
+
* [module.exports#update_row(row, url, req)](#exp_module_Jqgrid_utils--module.exports+update_row) ⇒ <code>object</code> ⏏
|
|
48
|
+
* [module.exports#delete_row(_id, url)](#exp_module_Jqgrid_utils--module.exports+delete_row) ⇒ <code>object</code> ⏏
|
|
49
|
+
* [module.exports#adelete_api(url)](#exp_module_Jqgrid_utils--module.exports+adelete_api) ⇒ <code>object</code> ⏏
|
|
50
|
+
* [module.exports#post_json(url, data)](#exp_module_Jqgrid_utils--module.exports+post_json) ⇒ <code>object</code> ⏏
|
|
51
|
+
* [module.exports#put_json(url, data)](#exp_module_Jqgrid_utils--module.exports+put_json) ⇒ <code>object</code> ⏏
|
|
52
|
+
* [module.exports#s_hide_del_icon()](#exp_module_Jqgrid_utils--module.exports+s_hide_del_icon) ⏏
|
|
51
53
|
* [module.exports#hide_del_icon()](#exp_module_Jqgrid_utils--module.exports+hide_del_icon) ⏏
|
|
52
|
-
* [module.exports#add_link_details()](#exp_module_Jqgrid_utils--module.exports+add_link_details) ⏏
|
|
53
|
-
* [module.exports#add_link_details_separator()](#exp_module_Jqgrid_utils--module.exports+add_link_details_separator) ⏏
|
|
54
|
+
* [module.exports#add_link_details(col_model, url, edit_field, attr, keys)](#exp_module_Jqgrid_utils--module.exports+add_link_details) ⏏
|
|
55
|
+
* [module.exports#add_link_details_separator(col_model, url, edit_field, attr, keys)](#exp_module_Jqgrid_utils--module.exports+add_link_details_separator) ⏏
|
|
54
56
|
* [module.exports#__cell_format()](#exp_module_Jqgrid_utils--module.exports+__cell_format) ⏏
|
|
55
57
|
* [module.exports#subgrid(_id, id, data_url, col_model, caption)](#exp_module_Jqgrid_utils--module.exports+subgrid) ⏏
|
|
56
58
|
* [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Jqgrid_utils--module.exports+add_image) ⏏
|
|
@@ -73,8 +75,26 @@ Add an URL from the data to a specific cell/column
|
|
|
73
75
|
|
|
74
76
|
**Example**
|
|
75
77
|
```js
|
|
78
|
+
var jqu = new Jqgrid_utils();
|
|
76
79
|
col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"');
|
|
77
80
|
```
|
|
81
|
+
<a name="exp_module_Jqgrid_utils--module.exports+s_grid_set_caption"></a>
|
|
82
|
+
|
|
83
|
+
### module.exports#s\_grid\_set\_caption(_grid, data) ⏏
|
|
84
|
+
**Kind**: Exported function
|
|
85
|
+
|
|
86
|
+
| Param | Type | Description |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| _grid | <code>object</code> | gridobject; |
|
|
89
|
+
| data | <code>object</code> | grid data (optional); |
|
|
90
|
+
|
|
91
|
+
**Example**
|
|
92
|
+
```js
|
|
93
|
+
var jqu = new Jqgrid_utils();
|
|
94
|
+
loadComplete: function(){
|
|
95
|
+
jqu.grid_set_caption(this);
|
|
96
|
+
},
|
|
97
|
+
```
|
|
78
98
|
<a name="exp_module_Jqgrid_utils--module.exports+grid_set_caption"></a>
|
|
79
99
|
|
|
80
100
|
### module.exports#grid\_set\_caption(_grid, data) ⏏
|
|
@@ -89,13 +109,24 @@ col_model = await jqu.set_link(col_model,'av0_code','url_code','target="blank"')
|
|
|
89
109
|
```js
|
|
90
110
|
var jqu = new Jqgrid_utils();
|
|
91
111
|
loadComplete: function(){
|
|
92
|
-
jqu.grid_set_caption(this);
|
|
112
|
+
await jqu.grid_set_caption(this);
|
|
93
113
|
},
|
|
94
114
|
```
|
|
95
115
|
<a name="exp_module_Jqgrid_utils--module.exports+s_resize_saved_cell_width"></a>
|
|
96
116
|
|
|
97
|
-
### module.exports#s\_resize\_saved\_cell\_width() ⏏
|
|
117
|
+
### module.exports#s\_resize\_saved\_cell\_width(col_model, page, grid) ⏏
|
|
98
118
|
**Kind**: Exported function
|
|
119
|
+
|
|
120
|
+
| Param | Type | Default | Description |
|
|
121
|
+
| --- | --- | --- | --- |
|
|
122
|
+
| col_model | <code>object</code> | | the col_model of the grid |
|
|
123
|
+
| page | <code>string</code> | <code>false</code> | the name of the page(optional) |
|
|
124
|
+
| grid | <code>object</code> | <code>false</code> | the grid objec(optional) |
|
|
125
|
+
|
|
126
|
+
**Example**
|
|
127
|
+
```js
|
|
128
|
+
col_model = await jqu.resize_saved_cell_width(col_model);
|
|
129
|
+
```
|
|
99
130
|
<a name="exp_module_Jqgrid_utils--module.exports+resize_saved_cell_width"></a>
|
|
100
131
|
|
|
101
132
|
### module.exports#resize\_saved\_cell\_width(col_model, page, grid) ⏏
|
|
@@ -129,55 +160,218 @@ resizeStop: jqu.resize_cell,
|
|
|
129
160
|
```
|
|
130
161
|
<a name="exp_module_Jqgrid_utils--module.exports+upsert_row"></a>
|
|
131
162
|
|
|
132
|
-
### module.exports#upsert\_row() ⏏
|
|
163
|
+
### module.exports#upsert\_row(row, url, req) ⇒ <code>object</code> ⏏
|
|
164
|
+
Upsert(insert or update) from the grid to an API
|
|
165
|
+
|
|
133
166
|
**Kind**: Exported function
|
|
167
|
+
**Returns**: <code>object</code> - {update: 'ok'} or {udpate: 'failed'}
|
|
168
|
+
|
|
169
|
+
| Param | Type | Description |
|
|
170
|
+
| --- | --- | --- |
|
|
171
|
+
| row | <code>object</code> | row object |
|
|
172
|
+
| url | <code>string</code> | url of the API |
|
|
173
|
+
| req | <code>string</code> | data oject |
|
|
174
|
+
|
|
175
|
+
**Example**
|
|
176
|
+
```js
|
|
177
|
+
var jqu = new Jqgrid_utils();
|
|
178
|
+
afterSetRow: async function(row)
|
|
179
|
+
{
|
|
180
|
+
let r = await jqu.upsert_row(row, url);
|
|
181
|
+
console.log(r);
|
|
182
|
+
},
|
|
183
|
+
```
|
|
134
184
|
<a name="exp_module_Jqgrid_utils--module.exports+insert_row"></a>
|
|
135
185
|
|
|
136
|
-
### module.exports#insert\_row() ⏏
|
|
186
|
+
### module.exports#insert\_row(row, url) ⇒ <code>object</code> ⏏
|
|
187
|
+
Insert from the grid to an API used by the upsert_row function
|
|
188
|
+
|
|
137
189
|
**Kind**: Exported function
|
|
190
|
+
**Returns**: <code>object</code> - Object from the the API like {update: 'ok'} or {update: 'failed'}
|
|
191
|
+
|
|
192
|
+
| Param | Type | Description |
|
|
193
|
+
| --- | --- | --- |
|
|
194
|
+
| row | <code>object</code> | row object |
|
|
195
|
+
| url | <code>string</code> | url of the API |
|
|
196
|
+
| | <code>string</code> | data oject |
|
|
197
|
+
|
|
198
|
+
**Example**
|
|
199
|
+
```js
|
|
200
|
+
var jqu = new Jqgrid_utils();
|
|
201
|
+
afterSetRow: async function(row)
|
|
202
|
+
{
|
|
203
|
+
let r = await jqu.upsert_row(row, url);
|
|
204
|
+
console.log(r);
|
|
205
|
+
},
|
|
206
|
+
```
|
|
138
207
|
<a name="exp_module_Jqgrid_utils--module.exports+update_row"></a>
|
|
139
208
|
|
|
140
|
-
### module.exports#update\_row() ⏏
|
|
209
|
+
### module.exports#update\_row(row, url, req) ⇒ <code>object</code> ⏏
|
|
210
|
+
Update from the grid to an API used by the upsert_row function
|
|
211
|
+
|
|
141
212
|
**Kind**: Exported function
|
|
213
|
+
**Returns**: <code>object</code> - Object from the the API like {update: 'ok'} or {update: 'failed'}
|
|
214
|
+
|
|
215
|
+
| Param | Type | Description |
|
|
216
|
+
| --- | --- | --- |
|
|
217
|
+
| row | <code>object</code> | row object |
|
|
218
|
+
| url | <code>string</code> | url of the API |
|
|
219
|
+
| req | <code>string</code> | data oject |
|
|
220
|
+
|
|
221
|
+
**Example**
|
|
222
|
+
```js
|
|
223
|
+
var jqu = new Jqgrid_utils();
|
|
224
|
+
afterSetRow: async function(row)
|
|
225
|
+
{
|
|
226
|
+
let r = await jqu.upsert_row(row, url);
|
|
227
|
+
console.log(r);
|
|
228
|
+
},
|
|
229
|
+
```
|
|
142
230
|
<a name="exp_module_Jqgrid_utils--module.exports+delete_row"></a>
|
|
143
231
|
|
|
144
|
-
### module.exports#delete\_row() ⏏
|
|
232
|
+
### module.exports#delete\_row(_id, url) ⇒ <code>object</code> ⏏
|
|
233
|
+
Delete from the grid to an API
|
|
234
|
+
|
|
145
235
|
**Kind**: Exported function
|
|
236
|
+
**Returns**: <code>object</code> - @returns {object} Object from the the API like {delete: 'ok'} or {delete: 'failed'}
|
|
237
|
+
|
|
238
|
+
| Param | Type | Description |
|
|
239
|
+
| --- | --- | --- |
|
|
240
|
+
| _id | <code>string</code> | row id |
|
|
241
|
+
| url | <code>string</code> | url of the API |
|
|
242
|
+
|
|
243
|
+
**Example**
|
|
244
|
+
```js
|
|
245
|
+
var jqu = new Jqgrid_utils();
|
|
246
|
+
afterDelRow: async function(row)
|
|
247
|
+
{
|
|
248
|
+
const r = await jqu.delete_row(row, url);
|
|
249
|
+
console.log(r + ' : ' + row + ' - from API');
|
|
250
|
+
},
|
|
251
|
+
```
|
|
146
252
|
<a name="exp_module_Jqgrid_utils--module.exports+adelete_api"></a>
|
|
147
253
|
|
|
148
|
-
### module.exports#adelete\_api() ⏏
|
|
254
|
+
### module.exports#adelete\_api(url) ⇒ <code>object</code> ⏏
|
|
255
|
+
Async Delete request used by function delete_row
|
|
256
|
+
|
|
149
257
|
**Kind**: Exported function
|
|
258
|
+
**Returns**: <code>object</code> - @returns {object} Object from the the API like {delete: 'ok'} or {delete: 'failed'}
|
|
259
|
+
|
|
260
|
+
| Param | Type | Description |
|
|
261
|
+
| --- | --- | --- |
|
|
262
|
+
| url | <code>string</code> | url of the API |
|
|
263
|
+
|
|
264
|
+
**Example**
|
|
265
|
+
```js
|
|
266
|
+
var jqu = new Jqgrid_utils();
|
|
267
|
+
afterDelRow: async function(row)
|
|
268
|
+
{
|
|
269
|
+
ret = JSON.parse(await jqu.adelete_api(url));
|
|
270
|
+
},
|
|
271
|
+
```
|
|
150
272
|
<a name="exp_module_Jqgrid_utils--module.exports+post_json"></a>
|
|
151
273
|
|
|
152
|
-
### module.exports#post\_json() ⏏
|
|
274
|
+
### module.exports#post\_json(url, data) ⇒ <code>object</code> ⏏
|
|
275
|
+
Async Post request used by the update_row function
|
|
276
|
+
|
|
153
277
|
**Kind**: Exported function
|
|
278
|
+
**Returns**: <code>object</code> - @returns {object} Object from the the API like {update: 'ok'} or {update: 'failed'}
|
|
279
|
+
|
|
280
|
+
| Param | Type | Description |
|
|
281
|
+
| --- | --- | --- |
|
|
282
|
+
| url | <code>string</code> | url of the API |
|
|
283
|
+
| data | <code>object</code> | json object |
|
|
284
|
+
|
|
285
|
+
**Example**
|
|
286
|
+
```js
|
|
287
|
+
var jqu = new Jqgrid_utils();
|
|
288
|
+
ret = JSON.parse(await jqu.post_json(url,{'key':value,'key2':'value'}));
|
|
289
|
+
```
|
|
154
290
|
<a name="exp_module_Jqgrid_utils--module.exports+put_json"></a>
|
|
155
291
|
|
|
156
|
-
### module.exports#put\_json() ⏏
|
|
292
|
+
### module.exports#put\_json(url, data) ⇒ <code>object</code> ⏏
|
|
293
|
+
Async Put request used by the insert_row function
|
|
294
|
+
|
|
157
295
|
**Kind**: Exported function
|
|
296
|
+
**Returns**: <code>object</code> - @returns {object} Object from the the API like {insert: 'ok'} or {insert: 'failed'}
|
|
297
|
+
|
|
298
|
+
| Param | Type | Description |
|
|
299
|
+
| --- | --- | --- |
|
|
300
|
+
| url | <code>string</code> | url of the API |
|
|
301
|
+
| data | <code>object</code> | json object |
|
|
302
|
+
|
|
303
|
+
**Example**
|
|
304
|
+
```js
|
|
305
|
+
var jqu = new Jqgrid_utils();
|
|
306
|
+
ret = JSON.parse(await jqu.put_json(url,{'key':value,'key2':'value2'}));
|
|
307
|
+
```
|
|
308
|
+
<a name="exp_module_Jqgrid_utils--module.exports+s_hide_del_icon"></a>
|
|
309
|
+
|
|
310
|
+
### module.exports#s\_hide\_del\_icon() ⏏
|
|
311
|
+
Hide the del iconf rom the grid
|
|
312
|
+
|
|
313
|
+
**Kind**: Exported function
|
|
314
|
+
**Example**
|
|
315
|
+
```js
|
|
316
|
+
var jqu = new Jqgrid_utils();
|
|
317
|
+
jqu.hide_del_icon();
|
|
318
|
+
```
|
|
158
319
|
<a name="exp_module_Jqgrid_utils--module.exports+hide_del_icon"></a>
|
|
159
320
|
|
|
160
321
|
### module.exports#hide\_del\_icon() ⏏
|
|
322
|
+
Hide the del iconf rom the grid
|
|
323
|
+
|
|
161
324
|
**Kind**: Exported function
|
|
325
|
+
**Example**
|
|
326
|
+
```js
|
|
327
|
+
var jqu = new Jqgrid_utils();
|
|
328
|
+
await jqu.hide_del_icon();
|
|
329
|
+
```
|
|
162
330
|
<a name="exp_module_Jqgrid_utils--module.exports+add_link_details"></a>
|
|
163
331
|
|
|
164
|
-
### module.exports#add\_link\_details() ⏏
|
|
332
|
+
### module.exports#add\_link\_details(col_model, url, edit_field, attr, keys) ⏏
|
|
333
|
+
Convert a cell into a link/url with data from another cell
|
|
334
|
+
|
|
165
335
|
**Kind**: Exported function
|
|
336
|
+
|
|
337
|
+
| Param | Type | Description |
|
|
338
|
+
| --- | --- | --- |
|
|
339
|
+
| col_model | <code>object</code> | col_model of the grid |
|
|
340
|
+
| url | <code>string</code> | URL string |
|
|
341
|
+
| edit_field | <code>string</code> | Column/Cell to use |
|
|
342
|
+
| attr | <code>string</code> | URL Attributes |
|
|
343
|
+
| keys | <code>object</code> | keys and fields value to use |
|
|
344
|
+
|
|
166
345
|
**Example**
|
|
167
346
|
```js
|
|
168
|
-
|
|
347
|
+
var jqu = new Jqgrid_utils();
|
|
348
|
+
col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
|
|
169
349
|
```
|
|
170
350
|
<a name="exp_module_Jqgrid_utils--module.exports+add_link_details_separator"></a>
|
|
171
351
|
|
|
172
|
-
### module.exports#add\_link\_details\_separator() ⏏
|
|
352
|
+
### module.exports#add\_link\_details\_separator(col_model, url, edit_field, attr, keys) ⏏
|
|
353
|
+
Convert a cell into seperated based link/url like https://foo.bar.com/field/value/field/value
|
|
354
|
+
|
|
173
355
|
**Kind**: Exported function
|
|
356
|
+
|
|
357
|
+
| Param | Type | Description |
|
|
358
|
+
| --- | --- | --- |
|
|
359
|
+
| col_model | <code>object</code> | col_model of the grid |
|
|
360
|
+
| url | <code>string</code> | URL string |
|
|
361
|
+
| edit_field | <code>string</code> | Column/Cell to use |
|
|
362
|
+
| attr | <code>string</code> | URL Attributes |
|
|
363
|
+
| keys | <code>object</code> | keys and fields value to use |
|
|
364
|
+
|
|
174
365
|
**Example**
|
|
175
366
|
```js
|
|
367
|
+
var jqu = new Jqgrid_utils();
|
|
176
368
|
col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
|
|
177
369
|
```
|
|
178
370
|
<a name="exp_module_Jqgrid_utils--module.exports+__cell_format"></a>
|
|
179
371
|
|
|
180
372
|
### module.exports#\_\_cell\_format() ⏏
|
|
373
|
+
Private Function
|
|
374
|
+
|
|
181
375
|
**Kind**: Exported function
|
|
182
376
|
<a name="exp_module_Jqgrid_utils--module.exports+subgrid"></a>
|
|
183
377
|
|
package/package.json
CHANGED