jqgrid_utils 1.4.3 → 1.4.6
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/.hgignore +17 -0
- package/README.md +46 -14
- package/_README.md +7 -14
- package/dist/jqgrid_utils.js +50 -14
- package/jqgrid_utils.js +50 -14
- package/package.json +2 -2
- package/sync_repo.sh +5 -0
package/.hgignore
ADDED
package/README.md
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
# Jqgrid_utils
|
|
2
2
|
Convenient Functions for free jqGrid
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Add a the library to your website
|
|
4
|
+
# How to install:
|
|
5
|
+
```bashh
|
|
6
|
+
npm install jqgrid_utils
|
|
7
|
+
```
|
|
10
8
|
|
|
9
|
+
# Usage:
|
|
11
10
|
```html
|
|
12
11
|
<script src="../node_modules/jqgrid_utils/dist/jqgrid_utils.js"></script>
|
|
13
12
|
```
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
Example
|
|
17
|
-
```javascript
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Init
|
|
22
|
-
* example:
|
|
15
|
+
# Example:
|
|
23
16
|
```javascript
|
|
24
17
|
let jqu = new Jqgrid_utils();
|
|
25
18
|
|
|
26
19
|
```
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
Source: https://w3.calantas.org/free-dockers/jqgrid_utils/
|
|
29
22
|
|
|
30
23
|
<a name="module_Jqgrid_utils"></a>
|
|
31
24
|
|
|
@@ -34,6 +27,8 @@ A module for Jqgrid_utils
|
|
|
34
27
|
|
|
35
28
|
|
|
36
29
|
* [Jqgrid_utils](#module_Jqgrid_utils)
|
|
30
|
+
* [module.exports#format_date112(col_model, edit_field, seperator)](#exp_module_Jqgrid_utils--module.exports+format_date112) ⏏
|
|
31
|
+
* [module.exports#add_ok_button(col_model, fields)](#exp_module_Jqgrid_utils--module.exports+add_ok_button) ⇒ <code>array</code> ⏏
|
|
37
32
|
* [module.exports#get_filled_cell_table_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data) ⇒ <code>array</code> ⏏
|
|
38
33
|
* [module.exports#get_filled_cell_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
|
|
39
34
|
* [module.exports#set_link(col_model, edit_field, url)](#exp_module_Jqgrid_utils--module.exports+set_link) ⇒ <code>object</code> ⏏
|
|
@@ -61,6 +56,43 @@ A module for Jqgrid_utils
|
|
|
61
56
|
* [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
|
|
62
57
|
* [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
|
|
63
58
|
|
|
59
|
+
<a name="exp_module_Jqgrid_utils--module.exports+format_date112"></a>
|
|
60
|
+
|
|
61
|
+
### module.exports#format\_date112(col_model, edit_field, seperator) ⏏
|
|
62
|
+
Convert a 112 date to a DMY format with sepertaor
|
|
63
|
+
|
|
64
|
+
**Kind**: Exported function
|
|
65
|
+
|
|
66
|
+
| Param | Type | Default | Description |
|
|
67
|
+
| --- | --- | --- | --- |
|
|
68
|
+
| col_model | <code>object</code> | | col_model of the grid |
|
|
69
|
+
| edit_field | <code>string</code> | | name of the date 112 column what should get converted |
|
|
70
|
+
| seperator | <code>string</code> | <code>"/"</code> | seperator used |
|
|
71
|
+
|
|
72
|
+
**Example**
|
|
73
|
+
```js
|
|
74
|
+
var jqu = new Jqgrid_utils();
|
|
75
|
+
let _data = await jqu.date_format(this,'field','/');
|
|
76
|
+
console.log(_data);
|
|
77
|
+
```
|
|
78
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_ok_button"></a>
|
|
79
|
+
|
|
80
|
+
### module.exports#add\_ok\_button(col_model, fields) ⇒ <code>array</code> ⏏
|
|
81
|
+
Add an OK Button
|
|
82
|
+
|
|
83
|
+
**Kind**: Exported function
|
|
84
|
+
**Returns**: <code>array</code> - - col_model
|
|
85
|
+
|
|
86
|
+
| Param | Type | Description |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| col_model | <code>array</code> | grid col_model |
|
|
89
|
+
| fields | <code>array</code> | list of columns names what will be converted to ok buttons |
|
|
90
|
+
|
|
91
|
+
**Example**
|
|
92
|
+
```js
|
|
93
|
+
var jqu = new Jqgrid_utils();
|
|
94
|
+
col_model = await jqu.add_ok_button(col_model, ['checked']);
|
|
95
|
+
```
|
|
64
96
|
<a name="exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data"></a>
|
|
65
97
|
|
|
66
98
|
### module.exports#get\_filled\_cell\_table\_data(_grid, fields) ⇒ <code>array</code> ⏏
|
package/_README.md
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
# Jqgrid_utils
|
|
2
2
|
Convenient Functions for free jqGrid
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Add a the library to your website
|
|
4
|
+
# How to install:
|
|
5
|
+
```bashh
|
|
6
|
+
npm install jqgrid_utils
|
|
7
|
+
```
|
|
10
8
|
|
|
9
|
+
# Usage:
|
|
11
10
|
```html
|
|
12
11
|
<script src="../node_modules/jqgrid_utils/dist/jqgrid_utils.js"></script>
|
|
13
12
|
```
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
Example
|
|
17
|
-
```javascript
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Init
|
|
22
|
-
* example:
|
|
15
|
+
# Example:
|
|
23
16
|
```javascript
|
|
24
17
|
let jqu = new Jqgrid_utils();
|
|
25
18
|
|
|
26
19
|
```
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
Source: https://w3.calantas.org/free-dockers/jqgrid_utils/
|
|
29
22
|
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -22,7 +22,40 @@ module.exports = class Vanilla_website_utils
|
|
|
22
22
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Convert a 112 date to a DMY format with sepertaor
|
|
27
|
+
@alias module:Jqgrid_utils
|
|
28
|
+
@param {object} - col_model of the grid
|
|
29
|
+
@param {string} - name of the date 112 column what should get converted
|
|
30
|
+
@param {string} - seperator used
|
|
31
|
+
@example
|
|
32
|
+
var jqu = new Jqgrid_utils();
|
|
33
|
+
let _data = await jqu.date_format(this,'field','/');
|
|
34
|
+
console.log(_data);
|
|
35
|
+
*/
|
|
36
|
+
async format_date112(col_model, edit_field , seperator='/')
|
|
37
|
+
{
|
|
38
|
+
for(let i=0;i< col_model.length;i++)
|
|
39
|
+
{
|
|
40
|
+
if(col_model[i]['name'] === edit_field)
|
|
41
|
+
{
|
|
42
|
+
col_model[i]['formatter'] = function (cell_value, o)
|
|
43
|
+
{
|
|
44
|
+
let value = cell_value;
|
|
45
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
46
|
+
{
|
|
47
|
+
let a = [];
|
|
48
|
+
a.push(cell_value.substr(6, 2));
|
|
49
|
+
a.push(cell_value.substr(4, 2));
|
|
50
|
+
a.push(cell_value.substr(0, 4));
|
|
51
|
+
value = a.join(seperator);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return col_model;
|
|
58
|
+
}
|
|
26
59
|
|
|
27
60
|
|
|
28
61
|
/**
|
|
@@ -229,21 +262,24 @@ loadComplete: function(){
|
|
|
229
262
|
*/
|
|
230
263
|
async grid_set_caption(_grid, data=[])
|
|
231
264
|
{
|
|
232
|
-
|
|
233
|
-
let count = 0;
|
|
234
|
-
if(data.length === 0)
|
|
235
|
-
{
|
|
236
|
-
count = grid.jqGrid('getGridParam', 'records');
|
|
237
|
-
}
|
|
238
|
-
else
|
|
265
|
+
if(_grid)
|
|
239
266
|
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
267
|
+
const grid = jQuery(_grid);
|
|
268
|
+
let count = 0;
|
|
269
|
+
if(data.length === 0)
|
|
270
|
+
{
|
|
271
|
+
count = grid.jqGrid('getGridParam', 'records');
|
|
272
|
+
}
|
|
273
|
+
else
|
|
274
|
+
{
|
|
275
|
+
count = data.length;
|
|
276
|
+
}
|
|
277
|
+
let caption = grid.jqGrid("getGridParam", "caption");
|
|
278
|
+
const reg = /\d.*x/;
|
|
279
|
+
const new_caption = caption.replace(reg, "");
|
|
280
|
+
grid.jqGrid('setCaption', new_caption + " " + count + 'x');
|
|
246
281
|
}
|
|
282
|
+
}
|
|
247
283
|
|
|
248
284
|
/**
|
|
249
285
|
@alias module:Jqgrid_utils
|
package/jqgrid_utils.js
CHANGED
|
@@ -21,7 +21,40 @@ module.exports = class Vanilla_website_utils
|
|
|
21
21
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Convert a 112 date to a DMY format with sepertaor
|
|
26
|
+
@alias module:Jqgrid_utils
|
|
27
|
+
@param {object} - col_model of the grid
|
|
28
|
+
@param {string} - name of the date 112 column what should get converted
|
|
29
|
+
@param {string} - seperator used
|
|
30
|
+
@example
|
|
31
|
+
var jqu = new Jqgrid_utils();
|
|
32
|
+
let _data = await jqu.date_format(this,'field','/');
|
|
33
|
+
console.log(_data);
|
|
34
|
+
*/
|
|
35
|
+
async format_date112(col_model, edit_field , seperator='/')
|
|
36
|
+
{
|
|
37
|
+
for(let i=0;i< col_model.length;i++)
|
|
38
|
+
{
|
|
39
|
+
if(col_model[i]['name'] === edit_field)
|
|
40
|
+
{
|
|
41
|
+
col_model[i]['formatter'] = function (cell_value, o)
|
|
42
|
+
{
|
|
43
|
+
let value = cell_value;
|
|
44
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
45
|
+
{
|
|
46
|
+
let a = [];
|
|
47
|
+
a.push(cell_value.substr(6, 2));
|
|
48
|
+
a.push(cell_value.substr(4, 2));
|
|
49
|
+
a.push(cell_value.substr(0, 4));
|
|
50
|
+
value = a.join(seperator);
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return col_model;
|
|
57
|
+
}
|
|
25
58
|
|
|
26
59
|
|
|
27
60
|
/**
|
|
@@ -228,21 +261,24 @@ loadComplete: function(){
|
|
|
228
261
|
*/
|
|
229
262
|
async grid_set_caption(_grid, data=[])
|
|
230
263
|
{
|
|
231
|
-
|
|
232
|
-
let count = 0;
|
|
233
|
-
if(data.length === 0)
|
|
234
|
-
{
|
|
235
|
-
count = grid.jqGrid('getGridParam', 'records');
|
|
236
|
-
}
|
|
237
|
-
else
|
|
264
|
+
if(_grid)
|
|
238
265
|
{
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
266
|
+
const grid = jQuery(_grid);
|
|
267
|
+
let count = 0;
|
|
268
|
+
if(data.length === 0)
|
|
269
|
+
{
|
|
270
|
+
count = grid.jqGrid('getGridParam', 'records');
|
|
271
|
+
}
|
|
272
|
+
else
|
|
273
|
+
{
|
|
274
|
+
count = data.length;
|
|
275
|
+
}
|
|
276
|
+
let caption = grid.jqGrid("getGridParam", "caption");
|
|
277
|
+
const reg = /\d.*x/;
|
|
278
|
+
const new_caption = caption.replace(reg, "");
|
|
279
|
+
grid.jqGrid('setCaption', new_caption + " " + count + 'x');
|
|
245
280
|
}
|
|
281
|
+
}
|
|
246
282
|
|
|
247
283
|
/**
|
|
248
284
|
@alias module:Jqgrid_utils
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{},
|
|
9
9
|
"deprecated": false,
|
|
10
10
|
"description": "Convenient Functions for the Free jqGrid",
|
|
11
|
-
"homepage": "
|
|
11
|
+
"homepage": "https://w3.calantas.org/free-dockers/jqgrid_utils",
|
|
12
12
|
"license": "GPL-3.0-or-later",
|
|
13
13
|
"main": "jqgrid_utils.js",
|
|
14
14
|
"name": "jqgrid_utils",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
{
|
|
30
30
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
31
31
|
},
|
|
32
|
-
"version": "1.4.
|
|
32
|
+
"version": "1.4.6"
|
|
33
33
|
}
|