jqgrid_utils 1.2.7 → 1.2.10
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 +76 -41
- package/dist/jqgrid_utils.js +44 -38
- package/jqgrid_utils.js +44 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,39 +54,58 @@ 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#
|
|
66
|
-
* [module.exports#
|
|
67
|
-
* [module.exports#
|
|
68
|
-
* [module.exports#
|
|
69
|
-
* [module.exports#
|
|
70
|
-
* [module.exports#
|
|
71
|
-
* [module.exports#
|
|
72
|
-
* [module.exports#
|
|
73
|
-
* [module.exports#
|
|
74
|
-
* [module.exports#
|
|
75
|
-
* [module.exports#
|
|
76
|
-
* [module.exports#
|
|
77
|
-
* [module.exports#
|
|
78
|
-
* [module.exports#
|
|
79
|
-
* [module.exports#
|
|
80
|
-
|
|
81
|
-
|
|
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_caption(_grid, data)](#exp_module_Jqgrid_utils--module.exports+grid_set_caption) ⏏
|
|
66
|
+
* [module.exports#s_resize_saved_cell_width()](#exp_module_Jqgrid_utils--module.exports+s_resize_saved_cell_width) ⏏
|
|
67
|
+
* [module.exports#resize_saved_cell_width(col_model, page, grid)](#exp_module_Jqgrid_utils--module.exports+resize_saved_cell_width) ⏏
|
|
68
|
+
* [module.exports#resize_cell(the, column, not)](#exp_module_Jqgrid_utils--module.exports+resize_cell) ⏏
|
|
69
|
+
* [module.exports#upsert_row()](#exp_module_Jqgrid_utils--module.exports+upsert_row) ⏏
|
|
70
|
+
* [module.exports#insert_row()](#exp_module_Jqgrid_utils--module.exports+insert_row) ⏏
|
|
71
|
+
* [module.exports#update_row()](#exp_module_Jqgrid_utils--module.exports+update_row) ⏏
|
|
72
|
+
* [module.exports#delete_row()](#exp_module_Jqgrid_utils--module.exports+delete_row) ⏏
|
|
73
|
+
* [module.exports#adelete_api()](#exp_module_Jqgrid_utils--module.exports+adelete_api) ⏏
|
|
74
|
+
* [module.exports#post_json()](#exp_module_Jqgrid_utils--module.exports+post_json) ⏏
|
|
75
|
+
* [module.exports#put_json()](#exp_module_Jqgrid_utils--module.exports+put_json) ⏏
|
|
76
|
+
* [module.exports#hide_del_icon()](#exp_module_Jqgrid_utils--module.exports+hide_del_icon) ⏏
|
|
77
|
+
* [module.exports#add_link_details()](#exp_module_Jqgrid_utils--module.exports+add_link_details) ⏏
|
|
78
|
+
* [module.exports#add_link_details_separator()](#exp_module_Jqgrid_utils--module.exports+add_link_details_separator) ⏏
|
|
79
|
+
* [module.exports#__cell_format()](#exp_module_Jqgrid_utils--module.exports+__cell_format) ⏏
|
|
80
|
+
* [module.exports#subgrid(_id, id, data_url, col_model, caption)](#exp_module_Jqgrid_utils--module.exports+subgrid) ⏏
|
|
81
|
+
* [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Jqgrid_utils--module.exports+add_image) ⏏
|
|
82
|
+
|
|
83
|
+
<a name="exp_module_Jqgrid_utils--module.exports+set_link"></a>
|
|
82
84
|
|
|
83
85
|
### module.exports#set\_link() ⏏
|
|
84
86
|
**Kind**: Exported function
|
|
85
|
-
<a name="
|
|
87
|
+
<a name="exp_module_Jqgrid_utils--module.exports+grid_set_caption"></a>
|
|
86
88
|
|
|
87
|
-
### module.exports#grid\_set\
|
|
89
|
+
### module.exports#grid\_set\_caption(_grid, data) ⏏
|
|
88
90
|
**Kind**: Exported function
|
|
89
|
-
|
|
91
|
+
|
|
92
|
+
| Param | Type | Description |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| _grid | <code>object</code> | gridobject; |
|
|
95
|
+
| data | <code>object</code> | grid data (optional); |
|
|
96
|
+
|
|
97
|
+
**Example**
|
|
98
|
+
```js
|
|
99
|
+
var jqu = new Jqgrid_utils();
|
|
100
|
+
loadComplete: function(){
|
|
101
|
+
jqu.grid_set_caption(this);
|
|
102
|
+
},
|
|
103
|
+
```
|
|
104
|
+
<a name="exp_module_Jqgrid_utils--module.exports+s_resize_saved_cell_width"></a>
|
|
105
|
+
|
|
106
|
+
### module.exports#s\_resize\_saved\_cell\_width() ⏏
|
|
107
|
+
**Kind**: Exported function
|
|
108
|
+
<a name="exp_module_Jqgrid_utils--module.exports+resize_saved_cell_width"></a>
|
|
90
109
|
|
|
91
110
|
### module.exports#resize\_saved\_cell\_width(col_model, page, grid) ⏏
|
|
92
111
|
**Kind**: Exported function
|
|
@@ -101,39 +120,55 @@ A module for Vanilla_website_utils
|
|
|
101
120
|
```js
|
|
102
121
|
col_model = await jqu.resize_saved_cell_width(col_model);
|
|
103
122
|
```
|
|
104
|
-
<a name="
|
|
123
|
+
<a name="exp_module_Jqgrid_utils--module.exports+resize_cell"></a>
|
|
124
|
+
|
|
125
|
+
### module.exports#resize\_cell(the, column, not) ⏏
|
|
126
|
+
**Kind**: Exported function
|
|
127
|
+
|
|
128
|
+
| Param | Type | Description |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| the | <code>string</code> | width of the resized column |
|
|
131
|
+
| column | <code>string</code> | number what get resized |
|
|
132
|
+
| not | <code>string</code> | in use yet |
|
|
133
|
+
|
|
134
|
+
**Example**
|
|
135
|
+
```js
|
|
136
|
+
var jqu = new Jqgrid_utils({page:'mypage'});
|
|
137
|
+
resizeStop: jqu.resize_cell,
|
|
138
|
+
```
|
|
139
|
+
<a name="exp_module_Jqgrid_utils--module.exports+upsert_row"></a>
|
|
105
140
|
|
|
106
141
|
### module.exports#upsert\_row() ⏏
|
|
107
142
|
**Kind**: Exported function
|
|
108
|
-
<a name="
|
|
143
|
+
<a name="exp_module_Jqgrid_utils--module.exports+insert_row"></a>
|
|
109
144
|
|
|
110
145
|
### module.exports#insert\_row() ⏏
|
|
111
146
|
**Kind**: Exported function
|
|
112
|
-
<a name="
|
|
147
|
+
<a name="exp_module_Jqgrid_utils--module.exports+update_row"></a>
|
|
113
148
|
|
|
114
149
|
### module.exports#update\_row() ⏏
|
|
115
150
|
**Kind**: Exported function
|
|
116
|
-
<a name="
|
|
151
|
+
<a name="exp_module_Jqgrid_utils--module.exports+delete_row"></a>
|
|
117
152
|
|
|
118
153
|
### module.exports#delete\_row() ⏏
|
|
119
154
|
**Kind**: Exported function
|
|
120
|
-
<a name="
|
|
155
|
+
<a name="exp_module_Jqgrid_utils--module.exports+adelete_api"></a>
|
|
121
156
|
|
|
122
157
|
### module.exports#adelete\_api() ⏏
|
|
123
158
|
**Kind**: Exported function
|
|
124
|
-
<a name="
|
|
159
|
+
<a name="exp_module_Jqgrid_utils--module.exports+post_json"></a>
|
|
125
160
|
|
|
126
161
|
### module.exports#post\_json() ⏏
|
|
127
162
|
**Kind**: Exported function
|
|
128
|
-
<a name="
|
|
163
|
+
<a name="exp_module_Jqgrid_utils--module.exports+put_json"></a>
|
|
129
164
|
|
|
130
165
|
### module.exports#put\_json() ⏏
|
|
131
166
|
**Kind**: Exported function
|
|
132
|
-
<a name="
|
|
167
|
+
<a name="exp_module_Jqgrid_utils--module.exports+hide_del_icon"></a>
|
|
133
168
|
|
|
134
169
|
### module.exports#hide\_del\_icon() ⏏
|
|
135
170
|
**Kind**: Exported function
|
|
136
|
-
<a name="
|
|
171
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_link_details"></a>
|
|
137
172
|
|
|
138
173
|
### module.exports#add\_link\_details() ⏏
|
|
139
174
|
**Kind**: Exported function
|
|
@@ -141,7 +176,7 @@ col_model = await jqu.resize_saved_cell_width(col_model);
|
|
|
141
176
|
```js
|
|
142
177
|
example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
|
|
143
178
|
```
|
|
144
|
-
<a name="
|
|
179
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_link_details_separator"></a>
|
|
145
180
|
|
|
146
181
|
### module.exports#add\_link\_details\_separator() ⏏
|
|
147
182
|
**Kind**: Exported function
|
|
@@ -149,11 +184,11 @@ example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 't
|
|
|
149
184
|
```js
|
|
150
185
|
col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
|
|
151
186
|
```
|
|
152
|
-
<a name="
|
|
187
|
+
<a name="exp_module_Jqgrid_utils--module.exports+__cell_format"></a>
|
|
153
188
|
|
|
154
189
|
### module.exports#\_\_cell\_format() ⏏
|
|
155
190
|
**Kind**: Exported function
|
|
156
|
-
<a name="
|
|
191
|
+
<a name="exp_module_Jqgrid_utils--module.exports+subgrid"></a>
|
|
157
192
|
|
|
158
193
|
### module.exports#subgrid(_id, id, data_url, col_model, caption) ⏏
|
|
159
194
|
**Kind**: Exported function
|
|
@@ -172,7 +207,7 @@ let data_url = api + '/phone_detail?f=data&_id=';
|
|
|
172
207
|
let col_model_url = api + '/phone_detail?f=col_model';
|
|
173
208
|
let col_model = JSON.parse(await vwu.aget_api(col_model_url))
|
|
174
209
|
```
|
|
175
|
-
<a name="
|
|
210
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_image"></a>
|
|
176
211
|
|
|
177
212
|
### module.exports#add\_image(col_model, edit_field, size, link) ⏏
|
|
178
213
|
**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
|
{
|
|
@@ -46,15 +46,22 @@ module.exports = class Vanilla_website_utils
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
s_grid_set_caption(_grid, data=[])
|
|
50
50
|
{
|
|
51
|
-
this.
|
|
51
|
+
this.grid_set_captionn(_grid, data=[]);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
@alias module:
|
|
55
|
+
@alias module:Jqgrid_utils
|
|
56
|
+
@param {object} - gridobject;
|
|
57
|
+
@param {object} - grid data (optional);
|
|
58
|
+
@example
|
|
59
|
+
var jqu = new Jqgrid_utils();
|
|
60
|
+
loadComplete: function(){
|
|
61
|
+
jqu.grid_set_caption(this);
|
|
62
|
+
},
|
|
56
63
|
*/
|
|
57
|
-
async
|
|
64
|
+
async grid_set_caption(_grid, data=[])
|
|
58
65
|
{
|
|
59
66
|
const grid = jQuery(_grid);
|
|
60
67
|
let count = 0;
|
|
@@ -67,26 +74,27 @@ module.exports = class Vanilla_website_utils
|
|
|
67
74
|
count = data.length;
|
|
68
75
|
}
|
|
69
76
|
let caption = grid.jqGrid("getGridParam", "caption");
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
77
|
+
const reg = /\d.*x/;
|
|
78
|
+
const new_caption = caption.replace(reg, "");
|
|
79
|
+
grid.jqGrid('setCaption', new_caption + count + 'x');
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
/**
|
|
83
|
+
@alias module:Jqgrid_utils
|
|
84
|
+
*/
|
|
85
|
+
s_resize_saved_cell_width(col_model, page=false, grid=false)
|
|
86
|
+
{
|
|
87
|
+
this.grid_set_captain(col_model, page, grid);
|
|
88
|
+
}
|
|
81
89
|
|
|
82
90
|
|
|
83
91
|
/**
|
|
84
|
-
@alias module:
|
|
92
|
+
@alias module:Jqgrid_utils
|
|
85
93
|
@param {object} - the col_model of the grid
|
|
86
94
|
@param {string} - the name of the page(optional)
|
|
87
95
|
@param {object} - the grid objec(optional)
|
|
88
96
|
@example
|
|
89
|
-
|
|
97
|
+
col_model = await jqu.resize_saved_cell_width(col_model);
|
|
90
98
|
*/
|
|
91
99
|
async resize_saved_cell_width(col_model,page=false, grid=false)
|
|
92
100
|
{
|
|
@@ -111,9 +119,7 @@ module.exports = class Vanilla_website_utils
|
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
|
-
@alias module:
|
|
115
|
-
* resize_cell
|
|
116
|
-
* call after resize a column
|
|
122
|
+
@alias module:Jqgrid_utils
|
|
117
123
|
@param {string} the width of the resized column
|
|
118
124
|
@param {string} column number what get resized
|
|
119
125
|
@param {string} not in use yet
|
|
@@ -141,7 +147,7 @@ module.exports = class Vanilla_website_utils
|
|
|
141
147
|
|
|
142
148
|
|
|
143
149
|
/**
|
|
144
|
-
@alias module:
|
|
150
|
+
@alias module:Jqgrid_utils
|
|
145
151
|
*/
|
|
146
152
|
async upsert_row(row, url, req = {})
|
|
147
153
|
{
|
|
@@ -158,7 +164,7 @@ async upsert_row(row, url, req = {})
|
|
|
158
164
|
}
|
|
159
165
|
|
|
160
166
|
/**
|
|
161
|
-
@alias module:
|
|
167
|
+
@alias module:Jqgrid_utils
|
|
162
168
|
*/
|
|
163
169
|
async insert_row(row, url)
|
|
164
170
|
{
|
|
@@ -182,7 +188,7 @@ async insert_row(row, url)
|
|
|
182
188
|
|
|
183
189
|
|
|
184
190
|
/**
|
|
185
|
-
@alias module:
|
|
191
|
+
@alias module:Jqgrid_utils
|
|
186
192
|
*/
|
|
187
193
|
async update_row(row, url, req = {})
|
|
188
194
|
{
|
|
@@ -205,7 +211,7 @@ async update_row(row, url, req = {})
|
|
|
205
211
|
}
|
|
206
212
|
|
|
207
213
|
/**
|
|
208
|
-
@alias module:
|
|
214
|
+
@alias module:Jqgrid_utils
|
|
209
215
|
*/
|
|
210
216
|
async delete_row(_id, url)
|
|
211
217
|
{
|
|
@@ -225,7 +231,7 @@ async delete_row(_id, url)
|
|
|
225
231
|
|
|
226
232
|
|
|
227
233
|
/**
|
|
228
|
-
@alias module:
|
|
234
|
+
@alias module:Jqgrid_utils
|
|
229
235
|
*/
|
|
230
236
|
async adelete_api(url, json = false)
|
|
231
237
|
{
|
|
@@ -243,7 +249,7 @@ async adelete_api(url, json = false)
|
|
|
243
249
|
|
|
244
250
|
|
|
245
251
|
/**
|
|
246
|
-
@alias module:
|
|
252
|
+
@alias module:Jqgrid_utils
|
|
247
253
|
*/
|
|
248
254
|
async post_json(url, data)
|
|
249
255
|
{
|
|
@@ -259,7 +265,7 @@ async post_json(url, data)
|
|
|
259
265
|
}
|
|
260
266
|
|
|
261
267
|
/**
|
|
262
|
-
@alias module:
|
|
268
|
+
@alias module:Jqgrid_utils
|
|
263
269
|
*/
|
|
264
270
|
async put_json(url, data)
|
|
265
271
|
{
|
|
@@ -281,7 +287,7 @@ s_hide_del_icon()
|
|
|
281
287
|
}
|
|
282
288
|
|
|
283
289
|
/**
|
|
284
|
-
@alias module:
|
|
290
|
+
@alias module:Jqgrid_utils
|
|
285
291
|
*/
|
|
286
292
|
async hide_del_icon()
|
|
287
293
|
{
|
|
@@ -291,7 +297,7 @@ async hide_del_icon()
|
|
|
291
297
|
|
|
292
298
|
|
|
293
299
|
/**
|
|
294
|
-
@alias module:
|
|
300
|
+
@alias module:Jqgrid_utils
|
|
295
301
|
@example
|
|
296
302
|
* example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
|
|
297
303
|
*/
|
|
@@ -363,7 +369,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
|
|
|
363
369
|
|
|
364
370
|
|
|
365
371
|
/**
|
|
366
|
-
@alias module:
|
|
372
|
+
@alias module:Jqgrid_utils
|
|
367
373
|
@example
|
|
368
374
|
* col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
|
|
369
375
|
*/
|
|
@@ -430,7 +436,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
|
|
|
430
436
|
|
|
431
437
|
|
|
432
438
|
/**
|
|
433
|
-
@alias module:
|
|
439
|
+
@alias module:Jqgrid_utils
|
|
434
440
|
*/
|
|
435
441
|
__cell_format(cell_value, format)
|
|
436
442
|
{
|
|
@@ -451,16 +457,16 @@ __cell_format(cell_value, format)
|
|
|
451
457
|
|
|
452
458
|
|
|
453
459
|
/**
|
|
454
|
-
@alias module:
|
|
460
|
+
@alias module:Jqgrid_utils
|
|
455
461
|
@param {string} - row_id
|
|
456
462
|
@param {string} - data id
|
|
457
463
|
@param {string} - url to request
|
|
458
464
|
@param {object} - col_model for the table
|
|
459
465
|
@param {string} - Add to the caption of the subgrid
|
|
460
466
|
@example
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
467
|
+
let data_url = api + '/phone_detail?f=data&_id=';
|
|
468
|
+
let col_model_url = api + '/phone_detail?f=col_model';
|
|
469
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url))
|
|
464
470
|
*/
|
|
465
471
|
async subgrid(_id, id, data_url, col_model, caption='' )
|
|
466
472
|
{
|
|
@@ -483,13 +489,13 @@ async subgrid(_id, id, data_url, col_model, caption='' )
|
|
|
483
489
|
|
|
484
490
|
|
|
485
491
|
/**
|
|
486
|
-
@alias module:
|
|
492
|
+
@alias module:Jqgrid_utils
|
|
487
493
|
@param {object} - col_model for the grid
|
|
488
494
|
@param {string} - field what include the image/picture href path like http://mypicture.png
|
|
489
495
|
@param {int} - size of the picture
|
|
490
496
|
@param {bolen} - image path should be a link
|
|
491
497
|
@example
|
|
492
|
-
|
|
498
|
+
col_model = await jqu.add_image(col_model, 'image', 60, false);
|
|
493
499
|
*/
|
|
494
500
|
async add_image(col_model, edit_field, size, link=false)
|
|
495
501
|
{
|
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
|
{
|
|
@@ -45,15 +45,22 @@ module.exports = class Vanilla_website_utils
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
s_grid_set_caption(_grid, data=[])
|
|
49
49
|
{
|
|
50
|
-
this.
|
|
50
|
+
this.grid_set_captionn(_grid, data=[]);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
@alias module:
|
|
54
|
+
@alias module:Jqgrid_utils
|
|
55
|
+
@param {object} - gridobject;
|
|
56
|
+
@param {object} - grid data (optional);
|
|
57
|
+
@example
|
|
58
|
+
var jqu = new Jqgrid_utils();
|
|
59
|
+
loadComplete: function(){
|
|
60
|
+
jqu.grid_set_caption(this);
|
|
61
|
+
},
|
|
55
62
|
*/
|
|
56
|
-
async
|
|
63
|
+
async grid_set_caption(_grid, data=[])
|
|
57
64
|
{
|
|
58
65
|
const grid = jQuery(_grid);
|
|
59
66
|
let count = 0;
|
|
@@ -66,26 +73,27 @@ module.exports = class Vanilla_website_utils
|
|
|
66
73
|
count = data.length;
|
|
67
74
|
}
|
|
68
75
|
let caption = grid.jqGrid("getGridParam", "caption");
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
76
|
+
const reg = /\d.*x/;
|
|
77
|
+
const new_caption = caption.replace(reg, "");
|
|
78
|
+
grid.jqGrid('setCaption', new_caption + count + 'x');
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
/**
|
|
82
|
+
@alias module:Jqgrid_utils
|
|
83
|
+
*/
|
|
84
|
+
s_resize_saved_cell_width(col_model, page=false, grid=false)
|
|
85
|
+
{
|
|
86
|
+
this.grid_set_captain(col_model, page, grid);
|
|
87
|
+
}
|
|
80
88
|
|
|
81
89
|
|
|
82
90
|
/**
|
|
83
|
-
@alias module:
|
|
91
|
+
@alias module:Jqgrid_utils
|
|
84
92
|
@param {object} - the col_model of the grid
|
|
85
93
|
@param {string} - the name of the page(optional)
|
|
86
94
|
@param {object} - the grid objec(optional)
|
|
87
95
|
@example
|
|
88
|
-
|
|
96
|
+
col_model = await jqu.resize_saved_cell_width(col_model);
|
|
89
97
|
*/
|
|
90
98
|
async resize_saved_cell_width(col_model,page=false, grid=false)
|
|
91
99
|
{
|
|
@@ -110,9 +118,7 @@ module.exports = class Vanilla_website_utils
|
|
|
110
118
|
}
|
|
111
119
|
|
|
112
120
|
/**
|
|
113
|
-
@alias module:
|
|
114
|
-
* resize_cell
|
|
115
|
-
* call after resize a column
|
|
121
|
+
@alias module:Jqgrid_utils
|
|
116
122
|
@param {string} the width of the resized column
|
|
117
123
|
@param {string} column number what get resized
|
|
118
124
|
@param {string} not in use yet
|
|
@@ -140,7 +146,7 @@ module.exports = class Vanilla_website_utils
|
|
|
140
146
|
|
|
141
147
|
|
|
142
148
|
/**
|
|
143
|
-
@alias module:
|
|
149
|
+
@alias module:Jqgrid_utils
|
|
144
150
|
*/
|
|
145
151
|
async upsert_row(row, url, req = {})
|
|
146
152
|
{
|
|
@@ -157,7 +163,7 @@ async upsert_row(row, url, req = {})
|
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
/**
|
|
160
|
-
@alias module:
|
|
166
|
+
@alias module:Jqgrid_utils
|
|
161
167
|
*/
|
|
162
168
|
async insert_row(row, url)
|
|
163
169
|
{
|
|
@@ -181,7 +187,7 @@ async insert_row(row, url)
|
|
|
181
187
|
|
|
182
188
|
|
|
183
189
|
/**
|
|
184
|
-
@alias module:
|
|
190
|
+
@alias module:Jqgrid_utils
|
|
185
191
|
*/
|
|
186
192
|
async update_row(row, url, req = {})
|
|
187
193
|
{
|
|
@@ -204,7 +210,7 @@ async update_row(row, url, req = {})
|
|
|
204
210
|
}
|
|
205
211
|
|
|
206
212
|
/**
|
|
207
|
-
@alias module:
|
|
213
|
+
@alias module:Jqgrid_utils
|
|
208
214
|
*/
|
|
209
215
|
async delete_row(_id, url)
|
|
210
216
|
{
|
|
@@ -224,7 +230,7 @@ async delete_row(_id, url)
|
|
|
224
230
|
|
|
225
231
|
|
|
226
232
|
/**
|
|
227
|
-
@alias module:
|
|
233
|
+
@alias module:Jqgrid_utils
|
|
228
234
|
*/
|
|
229
235
|
async adelete_api(url, json = false)
|
|
230
236
|
{
|
|
@@ -242,7 +248,7 @@ async adelete_api(url, json = false)
|
|
|
242
248
|
|
|
243
249
|
|
|
244
250
|
/**
|
|
245
|
-
@alias module:
|
|
251
|
+
@alias module:Jqgrid_utils
|
|
246
252
|
*/
|
|
247
253
|
async post_json(url, data)
|
|
248
254
|
{
|
|
@@ -258,7 +264,7 @@ async post_json(url, data)
|
|
|
258
264
|
}
|
|
259
265
|
|
|
260
266
|
/**
|
|
261
|
-
@alias module:
|
|
267
|
+
@alias module:Jqgrid_utils
|
|
262
268
|
*/
|
|
263
269
|
async put_json(url, data)
|
|
264
270
|
{
|
|
@@ -280,7 +286,7 @@ s_hide_del_icon()
|
|
|
280
286
|
}
|
|
281
287
|
|
|
282
288
|
/**
|
|
283
|
-
@alias module:
|
|
289
|
+
@alias module:Jqgrid_utils
|
|
284
290
|
*/
|
|
285
291
|
async hide_del_icon()
|
|
286
292
|
{
|
|
@@ -290,7 +296,7 @@ async hide_del_icon()
|
|
|
290
296
|
|
|
291
297
|
|
|
292
298
|
/**
|
|
293
|
-
@alias module:
|
|
299
|
+
@alias module:Jqgrid_utils
|
|
294
300
|
@example
|
|
295
301
|
* example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
|
|
296
302
|
*/
|
|
@@ -362,7 +368,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
|
|
|
362
368
|
|
|
363
369
|
|
|
364
370
|
/**
|
|
365
|
-
@alias module:
|
|
371
|
+
@alias module:Jqgrid_utils
|
|
366
372
|
@example
|
|
367
373
|
* col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
|
|
368
374
|
*/
|
|
@@ -429,7 +435,7 @@ async add_link_details_separator(col_model, url, edit_field, attr = '', keys, fo
|
|
|
429
435
|
|
|
430
436
|
|
|
431
437
|
/**
|
|
432
|
-
@alias module:
|
|
438
|
+
@alias module:Jqgrid_utils
|
|
433
439
|
*/
|
|
434
440
|
__cell_format(cell_value, format)
|
|
435
441
|
{
|
|
@@ -450,16 +456,16 @@ __cell_format(cell_value, format)
|
|
|
450
456
|
|
|
451
457
|
|
|
452
458
|
/**
|
|
453
|
-
@alias module:
|
|
459
|
+
@alias module:Jqgrid_utils
|
|
454
460
|
@param {string} - row_id
|
|
455
461
|
@param {string} - data id
|
|
456
462
|
@param {string} - url to request
|
|
457
463
|
@param {object} - col_model for the table
|
|
458
464
|
@param {string} - Add to the caption of the subgrid
|
|
459
465
|
@example
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
466
|
+
let data_url = api + '/phone_detail?f=data&_id=';
|
|
467
|
+
let col_model_url = api + '/phone_detail?f=col_model';
|
|
468
|
+
let col_model = JSON.parse(await vwu.aget_api(col_model_url))
|
|
463
469
|
*/
|
|
464
470
|
async subgrid(_id, id, data_url, col_model, caption='' )
|
|
465
471
|
{
|
|
@@ -482,13 +488,13 @@ async subgrid(_id, id, data_url, col_model, caption='' )
|
|
|
482
488
|
|
|
483
489
|
|
|
484
490
|
/**
|
|
485
|
-
@alias module:
|
|
491
|
+
@alias module:Jqgrid_utils
|
|
486
492
|
@param {object} - col_model for the grid
|
|
487
493
|
@param {string} - field what include the image/picture href path like http://mypicture.png
|
|
488
494
|
@param {int} - size of the picture
|
|
489
495
|
@param {bolen} - image path should be a link
|
|
490
496
|
@example
|
|
491
|
-
|
|
497
|
+
col_model = await jqu.add_image(col_model, 'image', 60, false);
|
|
492
498
|
*/
|
|
493
499
|
async add_image(col_model, edit_field, size, link=false)
|
|
494
500
|
{
|
package/package.json
CHANGED