jqgrid_utils 1.4.5 → 1.4.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 +39 -0
- package/dist/jqgrid_utils.js +59 -0
- package/jqgrid_utils.js +59 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ A module for Jqgrid_utils
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
* [Jqgrid_utils](#module_Jqgrid_utils)
|
|
30
|
+
* [module.exports#_date112_to_DMY(cell_value, seperator)](#exp_module_Jqgrid_utils--module.exports+_date112_to_DMY) ⏏
|
|
31
|
+
* [module.exports#date112_to_DMY(col_model, edit_field, seperator)](#exp_module_Jqgrid_utils--module.exports+date112_to_DMY) ⏏
|
|
30
32
|
* [module.exports#add_ok_button(col_model, fields)](#exp_module_Jqgrid_utils--module.exports+add_ok_button) ⇒ <code>array</code> ⏏
|
|
31
33
|
* [module.exports#get_filled_cell_table_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data) ⇒ <code>array</code> ⏏
|
|
32
34
|
* [module.exports#get_filled_cell_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
|
|
@@ -55,6 +57,43 @@ A module for Jqgrid_utils
|
|
|
55
57
|
* [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
|
|
56
58
|
* [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
|
|
57
59
|
|
|
60
|
+
<a name="exp_module_Jqgrid_utils--module.exports+_date112_to_DMY"></a>
|
|
61
|
+
|
|
62
|
+
### module.exports#\_date112\_to\_DMY(cell_value, seperator) ⏏
|
|
63
|
+
Convert a 112 date string to a DMY format with sepertaor - sync function
|
|
64
|
+
|
|
65
|
+
**Kind**: Exported function
|
|
66
|
+
|
|
67
|
+
| Param | Type | Default | Description |
|
|
68
|
+
| --- | --- | --- | --- |
|
|
69
|
+
| cell_value | <code>string</code> | | date string |
|
|
70
|
+
| seperator | <code>string</code> | <code>"/"</code> | seperator used |
|
|
71
|
+
|
|
72
|
+
**Example**
|
|
73
|
+
```js
|
|
74
|
+
var jqu = new Jqgrid_utils();
|
|
75
|
+
let _data = jqu._date112_to_DMY('20220104','/');
|
|
76
|
+
console.log(_data);
|
|
77
|
+
```
|
|
78
|
+
<a name="exp_module_Jqgrid_utils--module.exports+date112_to_DMY"></a>
|
|
79
|
+
|
|
80
|
+
### module.exports#date112\_to\_DMY(col_model, edit_field, seperator) ⏏
|
|
81
|
+
Convert a 112 date to a DMY format with sepertaor
|
|
82
|
+
|
|
83
|
+
**Kind**: Exported function
|
|
84
|
+
|
|
85
|
+
| Param | Type | Default | Description |
|
|
86
|
+
| --- | --- | --- | --- |
|
|
87
|
+
| col_model | <code>object</code> | | col_model of the grid |
|
|
88
|
+
| edit_field | <code>string</code> | | name of the date 112 column what should get converted |
|
|
89
|
+
| seperator | <code>string</code> | <code>"/"</code> | seperator used |
|
|
90
|
+
|
|
91
|
+
**Example**
|
|
92
|
+
```js
|
|
93
|
+
var jqu = new Jqgrid_utils();
|
|
94
|
+
let _data = await jqu.date112_to_DMY(this,'field','/');
|
|
95
|
+
console.log(_data);
|
|
96
|
+
```
|
|
58
97
|
<a name="exp_module_Jqgrid_utils--module.exports+add_ok_button"></a>
|
|
59
98
|
|
|
60
99
|
### module.exports#add\_ok\_button(col_model, fields) ⇒ <code>array</code> ⏏
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -23,6 +23,65 @@ module.exports = class Vanilla_website_utils
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Convert a 112 date string to a DMY format with sepertaor - sync function
|
|
28
|
+
@alias module:Jqgrid_utils
|
|
29
|
+
@param {string} - date string
|
|
30
|
+
@param {string} - seperator used
|
|
31
|
+
@example
|
|
32
|
+
var jqu = new Jqgrid_utils();
|
|
33
|
+
let _data = jqu._date112_to_DMY('20220104','/');
|
|
34
|
+
console.log(_data);
|
|
35
|
+
*/
|
|
36
|
+
_date112_to_DMY(cell_value, seperator='/')
|
|
37
|
+
{
|
|
38
|
+
let value = cell_value;
|
|
39
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
40
|
+
{
|
|
41
|
+
let a = [];
|
|
42
|
+
a.push(cell_value.substr(6, 2));
|
|
43
|
+
a.push(cell_value.substr(4, 2));
|
|
44
|
+
a.push(cell_value.substr(0, 4));
|
|
45
|
+
value = a.join(seperator);
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Convert a 112 date to a DMY format with sepertaor
|
|
53
|
+
@alias module:Jqgrid_utils
|
|
54
|
+
@param {object} - col_model of the grid
|
|
55
|
+
@param {string} - name of the date 112 column what should get converted
|
|
56
|
+
@param {string} - seperator used
|
|
57
|
+
@example
|
|
58
|
+
var jqu = new Jqgrid_utils();
|
|
59
|
+
let _data = await jqu.date112_to_DMY(this,'field','/');
|
|
60
|
+
console.log(_data);
|
|
61
|
+
*/
|
|
62
|
+
async date112_to_DMY(col_model, edit_field , seperator='/')
|
|
63
|
+
{
|
|
64
|
+
for(let i=0;i< col_model.length;i++)
|
|
65
|
+
{
|
|
66
|
+
if(col_model[i]['name'] === edit_field)
|
|
67
|
+
{
|
|
68
|
+
col_model[i]['formatter'] = function (cell_value, o)
|
|
69
|
+
{
|
|
70
|
+
let value = cell_value;
|
|
71
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
72
|
+
{
|
|
73
|
+
let a = [];
|
|
74
|
+
a.push(cell_value.substr(6, 2));
|
|
75
|
+
a.push(cell_value.substr(4, 2));
|
|
76
|
+
a.push(cell_value.substr(0, 4));
|
|
77
|
+
value = a.join(seperator);
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return col_model;
|
|
84
|
+
}
|
|
26
85
|
|
|
27
86
|
|
|
28
87
|
/**
|
package/jqgrid_utils.js
CHANGED
|
@@ -22,6 +22,65 @@ module.exports = class Vanilla_website_utils
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Convert a 112 date string to a DMY format with sepertaor - sync function
|
|
27
|
+
@alias module:Jqgrid_utils
|
|
28
|
+
@param {string} - date string
|
|
29
|
+
@param {string} - seperator used
|
|
30
|
+
@example
|
|
31
|
+
var jqu = new Jqgrid_utils();
|
|
32
|
+
let _data = jqu._date112_to_DMY('20220104','/');
|
|
33
|
+
console.log(_data);
|
|
34
|
+
*/
|
|
35
|
+
_date112_to_DMY(cell_value, seperator='/')
|
|
36
|
+
{
|
|
37
|
+
let value = cell_value;
|
|
38
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
39
|
+
{
|
|
40
|
+
let a = [];
|
|
41
|
+
a.push(cell_value.substr(6, 2));
|
|
42
|
+
a.push(cell_value.substr(4, 2));
|
|
43
|
+
a.push(cell_value.substr(0, 4));
|
|
44
|
+
value = a.join(seperator);
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Convert a 112 date to a DMY format with sepertaor
|
|
52
|
+
@alias module:Jqgrid_utils
|
|
53
|
+
@param {object} - col_model of the grid
|
|
54
|
+
@param {string} - name of the date 112 column what should get converted
|
|
55
|
+
@param {string} - seperator used
|
|
56
|
+
@example
|
|
57
|
+
var jqu = new Jqgrid_utils();
|
|
58
|
+
let _data = await jqu.date112_to_DMY(this,'field','/');
|
|
59
|
+
console.log(_data);
|
|
60
|
+
*/
|
|
61
|
+
async date112_to_DMY(col_model, edit_field , seperator='/')
|
|
62
|
+
{
|
|
63
|
+
for(let i=0;i< col_model.length;i++)
|
|
64
|
+
{
|
|
65
|
+
if(col_model[i]['name'] === edit_field)
|
|
66
|
+
{
|
|
67
|
+
col_model[i]['formatter'] = function (cell_value, o)
|
|
68
|
+
{
|
|
69
|
+
let value = cell_value;
|
|
70
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
71
|
+
{
|
|
72
|
+
let a = [];
|
|
73
|
+
a.push(cell_value.substr(6, 2));
|
|
74
|
+
a.push(cell_value.substr(4, 2));
|
|
75
|
+
a.push(cell_value.substr(0, 4));
|
|
76
|
+
value = a.join(seperator);
|
|
77
|
+
}
|
|
78
|
+
return value;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return col_model;
|
|
83
|
+
}
|
|
25
84
|
|
|
26
85
|
|
|
27
86
|
/**
|
package/package.json
CHANGED