jqgrid_utils 1.5.5 → 1.6.0
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 +57 -1
- package/jqgrid_utils.js +57 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,9 +27,11 @@ A module for Jqgrid_utils
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
* [Jqgrid_utils](#module_Jqgrid_utils)
|
|
30
|
+
* [module.exports#add_textarea(col_model, edit_field)](#exp_module_Jqgrid_utils--module.exports+add_textarea) ⏏
|
|
30
31
|
* [module.exports#get_col_model_from_data(obj, data, exclude, col_model)](#exp_module_Jqgrid_utils--module.exports+get_col_model_from_data) ⇒ <code>array</code> ⏏
|
|
31
32
|
* [module.exports#_date112_to_DMY(cell_value, seperator)](#exp_module_Jqgrid_utils--module.exports+_date112_to_DMY) ⏏
|
|
32
33
|
* [module.exports#date112_to_DMY(col_model, edit_field, seperator)](#exp_module_Jqgrid_utils--module.exports+date112_to_DMY) ⏏
|
|
34
|
+
* [module.exports#add_html_formatter(col_model, edit_field, html)](#exp_module_Jqgrid_utils--module.exports+add_html_formatter) ⇒ <code>array</code> ⏏
|
|
33
35
|
* [module.exports#add_ok_button(col_model, fields)](#exp_module_Jqgrid_utils--module.exports+add_ok_button) ⇒ <code>array</code> ⏏
|
|
34
36
|
* [module.exports#get_filled_cell_table_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data) ⇒ <code>array</code> ⏏
|
|
35
37
|
* [module.exports#get_filled_cell_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
|
|
@@ -58,6 +60,24 @@ A module for Jqgrid_utils
|
|
|
58
60
|
* [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
|
|
59
61
|
* [module.exports#_filter()](#exp_module_Jqgrid_utils--module.exports+_filter) ⏏
|
|
60
62
|
|
|
63
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_textarea"></a>
|
|
64
|
+
|
|
65
|
+
### module.exports#add\_textarea(col_model, edit_field) ⏏
|
|
66
|
+
add textarea
|
|
67
|
+
|
|
68
|
+
**Kind**: Exported function
|
|
69
|
+
|
|
70
|
+
| Param | Type | Description |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| col_model | <code>string</code> | edit_filed |
|
|
73
|
+
| edit_field | <code>string</code> | style of the textaread |
|
|
74
|
+
|
|
75
|
+
**Example**
|
|
76
|
+
```js
|
|
77
|
+
var jqu = new Jqgrid_utils();
|
|
78
|
+
let _data = jqu._date112_to_DMY('20220104','/');
|
|
79
|
+
console.log(_data);
|
|
80
|
+
```
|
|
61
81
|
<a name="exp_module_Jqgrid_utils--module.exports+get_col_model_from_data"></a>
|
|
62
82
|
|
|
63
83
|
### module.exports#get\_col\_model\_from\_data(obj, data, exclude, col_model) ⇒ <code>array</code> ⏏
|
|
@@ -120,6 +140,25 @@ var jqu = new Jqgrid_utils();
|
|
|
120
140
|
let _data = await jqu.date112_to_DMY(this,'field','/');
|
|
121
141
|
console.log(_data);
|
|
122
142
|
```
|
|
143
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_html_formatter"></a>
|
|
144
|
+
|
|
145
|
+
### module.exports#add\_html\_formatter(col_model, edit_field, html) ⇒ <code>array</code> ⏏
|
|
146
|
+
Add HTML Formatter
|
|
147
|
+
|
|
148
|
+
**Kind**: Exported function
|
|
149
|
+
**Returns**: <code>array</code> - - col_model
|
|
150
|
+
|
|
151
|
+
| Param | Type | Description |
|
|
152
|
+
| --- | --- | --- |
|
|
153
|
+
| col_model | <code>array</code> | grid col_model |
|
|
154
|
+
| edit_field | <code>string</code> | string columns names what will be converted to ok buttons |
|
|
155
|
+
| html | <code>string</code> | html tag code |
|
|
156
|
+
|
|
157
|
+
**Example**
|
|
158
|
+
```js
|
|
159
|
+
var jqu = new Jqgrid_utils();
|
|
160
|
+
col_model = await jqu.add_html_formatter(col_model,'process',"<button tabindex='0' class='cellbtn' type='button'>Process</button>");
|
|
161
|
+
```
|
|
123
162
|
<a name="exp_module_Jqgrid_utils--module.exports+add_ok_button"></a>
|
|
124
163
|
|
|
125
164
|
### module.exports#add\_ok\_button(col_model, fields) ⇒ <code>array</code> ⏏
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -22,6 +22,35 @@ module.exports = class Vanilla_website_utils
|
|
|
22
22
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* add textarea
|
|
29
|
+
@alias module:Jqgrid_utils
|
|
30
|
+
@param {string} - edit_filed
|
|
31
|
+
@param {string} - style of the textaread
|
|
32
|
+
@example
|
|
33
|
+
var jqu = new Jqgrid_utils();
|
|
34
|
+
let _data = jqu._date112_to_DMY('20220104','/');
|
|
35
|
+
console.log(_data);
|
|
36
|
+
*/
|
|
37
|
+
async add_textarea(col_model, edit_field, style = 'style="width:100%;height:450px"')
|
|
38
|
+
{
|
|
39
|
+
let f = window.sqlFormatter;
|
|
40
|
+
for (let i = 0; i < col_model.length; i++)
|
|
41
|
+
{
|
|
42
|
+
if (col_model[i]['name'] === edit_field)
|
|
43
|
+
{
|
|
44
|
+
col_model[i]['formatter'] = function(cell_val)
|
|
45
|
+
{
|
|
46
|
+
let sql = '<textarea '+ style +'>' + cell_val + '</textarea>' ;
|
|
47
|
+
return sql;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return col_model;
|
|
52
|
+
}
|
|
53
|
+
|
|
25
54
|
/**
|
|
26
55
|
* Get basic colModel data from raw data
|
|
27
56
|
@alias module:Jqgrid_utils
|
|
@@ -142,6 +171,33 @@ console.log(_data);
|
|
|
142
171
|
}
|
|
143
172
|
|
|
144
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Add HTML Formatter
|
|
176
|
+
@alias module:Jqgrid_utils
|
|
177
|
+
@param {array} - grid col_model
|
|
178
|
+
@param {string} - string columns names what will be converted to ok buttons
|
|
179
|
+
@param {string} - html tag code
|
|
180
|
+
@returns {array} - col_model
|
|
181
|
+
@example
|
|
182
|
+
var jqu = new Jqgrid_utils();
|
|
183
|
+
col_model = await jqu.add_html_formatter(col_model,'process',"<button tabindex='0' class='cellbtn' type='button'>Process</button>");
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
async add_html_formatter(col_model, edit_field, html)
|
|
187
|
+
{
|
|
188
|
+
for(let i=0;i< col_model.length;i++)
|
|
189
|
+
{
|
|
190
|
+
if(col_model[i]['name'] === edit_field)
|
|
191
|
+
{
|
|
192
|
+
col_model[i]['formatter'] = function (cell_val,o)
|
|
193
|
+
{
|
|
194
|
+
return html;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return col_model;
|
|
199
|
+
}
|
|
200
|
+
|
|
145
201
|
/**
|
|
146
202
|
* Add an OK Button
|
|
147
203
|
@alias module:Jqgrid_utils
|
|
@@ -175,7 +231,7 @@ async add_ok_button(col_model, fields)
|
|
|
175
231
|
}
|
|
176
232
|
return col_model;
|
|
177
233
|
}
|
|
178
|
-
|
|
234
|
+
|
|
179
235
|
|
|
180
236
|
|
|
181
237
|
/**
|
package/jqgrid_utils.js
CHANGED
|
@@ -21,6 +21,35 @@ module.exports = class Vanilla_website_utils
|
|
|
21
21
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* add textarea
|
|
28
|
+
@alias module:Jqgrid_utils
|
|
29
|
+
@param {string} - edit_filed
|
|
30
|
+
@param {string} - style of the textaread
|
|
31
|
+
@example
|
|
32
|
+
var jqu = new Jqgrid_utils();
|
|
33
|
+
let _data = jqu._date112_to_DMY('20220104','/');
|
|
34
|
+
console.log(_data);
|
|
35
|
+
*/
|
|
36
|
+
async add_textarea(col_model, edit_field, style = 'style="width:100%;height:450px"')
|
|
37
|
+
{
|
|
38
|
+
let f = window.sqlFormatter;
|
|
39
|
+
for (let i = 0; i < col_model.length; i++)
|
|
40
|
+
{
|
|
41
|
+
if (col_model[i]['name'] === edit_field)
|
|
42
|
+
{
|
|
43
|
+
col_model[i]['formatter'] = function(cell_val)
|
|
44
|
+
{
|
|
45
|
+
let sql = '<textarea '+ style +'>' + cell_val + '</textarea>' ;
|
|
46
|
+
return sql;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return col_model;
|
|
51
|
+
}
|
|
52
|
+
|
|
24
53
|
/**
|
|
25
54
|
* Get basic colModel data from raw data
|
|
26
55
|
@alias module:Jqgrid_utils
|
|
@@ -141,6 +170,33 @@ console.log(_data);
|
|
|
141
170
|
}
|
|
142
171
|
|
|
143
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Add HTML Formatter
|
|
175
|
+
@alias module:Jqgrid_utils
|
|
176
|
+
@param {array} - grid col_model
|
|
177
|
+
@param {string} - string columns names what will be converted to ok buttons
|
|
178
|
+
@param {string} - html tag code
|
|
179
|
+
@returns {array} - col_model
|
|
180
|
+
@example
|
|
181
|
+
var jqu = new Jqgrid_utils();
|
|
182
|
+
col_model = await jqu.add_html_formatter(col_model,'process',"<button tabindex='0' class='cellbtn' type='button'>Process</button>");
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
async add_html_formatter(col_model, edit_field, html)
|
|
186
|
+
{
|
|
187
|
+
for(let i=0;i< col_model.length;i++)
|
|
188
|
+
{
|
|
189
|
+
if(col_model[i]['name'] === edit_field)
|
|
190
|
+
{
|
|
191
|
+
col_model[i]['formatter'] = function (cell_val,o)
|
|
192
|
+
{
|
|
193
|
+
return html;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return col_model;
|
|
198
|
+
}
|
|
199
|
+
|
|
144
200
|
/**
|
|
145
201
|
* Add an OK Button
|
|
146
202
|
@alias module:Jqgrid_utils
|
|
@@ -174,7 +230,7 @@ async add_ok_button(col_model, fields)
|
|
|
174
230
|
}
|
|
175
231
|
return col_model;
|
|
176
232
|
}
|
|
177
|
-
|
|
233
|
+
|
|
178
234
|
|
|
179
235
|
|
|
180
236
|
/**
|
package/package.json
CHANGED