jqgrid_utils 1.5.4 → 1.5.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/README.md +20 -0
- package/dist/jqgrid_utils.js +45 -11
- package/jqgrid_utils.js +45 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ A module for Jqgrid_utils
|
|
|
30
30
|
* [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
31
|
* [module.exports#_date112_to_DMY(cell_value, seperator)](#exp_module_Jqgrid_utils--module.exports+_date112_to_DMY) ⏏
|
|
32
32
|
* [module.exports#date112_to_DMY(col_model, edit_field, seperator)](#exp_module_Jqgrid_utils--module.exports+date112_to_DMY) ⏏
|
|
33
|
+
* [module.exports#add_html_formatter(col_model, edit_field, html)](#exp_module_Jqgrid_utils--module.exports+add_html_formatter) ⇒ <code>array</code> ⏏
|
|
33
34
|
* [module.exports#add_ok_button(col_model, fields)](#exp_module_Jqgrid_utils--module.exports+add_ok_button) ⇒ <code>array</code> ⏏
|
|
34
35
|
* [module.exports#get_filled_cell_table_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_table_data) ⇒ <code>array</code> ⏏
|
|
35
36
|
* [module.exports#get_filled_cell_data(_grid, fields)](#exp_module_Jqgrid_utils--module.exports+get_filled_cell_data) ⇒ <code>object</code> ⏏
|
|
@@ -120,6 +121,25 @@ var jqu = new Jqgrid_utils();
|
|
|
120
121
|
let _data = await jqu.date112_to_DMY(this,'field','/');
|
|
121
122
|
console.log(_data);
|
|
122
123
|
```
|
|
124
|
+
<a name="exp_module_Jqgrid_utils--module.exports+add_html_formatter"></a>
|
|
125
|
+
|
|
126
|
+
### module.exports#add\_html\_formatter(col_model, edit_field, html) ⇒ <code>array</code> ⏏
|
|
127
|
+
Add HTML Formatter
|
|
128
|
+
|
|
129
|
+
**Kind**: Exported function
|
|
130
|
+
**Returns**: <code>array</code> - - col_model
|
|
131
|
+
|
|
132
|
+
| Param | Type | Description |
|
|
133
|
+
| --- | --- | --- |
|
|
134
|
+
| col_model | <code>array</code> | grid col_model |
|
|
135
|
+
| edit_field | <code>string</code> | string columns names what will be converted to ok buttons |
|
|
136
|
+
| html | <code>string</code> | html tag code |
|
|
137
|
+
|
|
138
|
+
**Example**
|
|
139
|
+
```js
|
|
140
|
+
var jqu = new Jqgrid_utils();
|
|
141
|
+
col_model = await jqu.add_html_formatter(col_model,'process',"<button tabindex='0' class='cellbtn' type='button'>Process</button>");
|
|
142
|
+
```
|
|
123
143
|
<a name="exp_module_Jqgrid_utils--module.exports+add_ok_button"></a>
|
|
124
144
|
|
|
125
145
|
### module.exports#add\_ok\_button(col_model, fields) ⇒ <code>array</code> ⏏
|
package/dist/jqgrid_utils.js
CHANGED
|
@@ -117,17 +117,24 @@ console.log(_data);
|
|
|
117
117
|
{
|
|
118
118
|
col_model[i]['formatter'] = function (cell_value, o)
|
|
119
119
|
{
|
|
120
|
-
cell_value
|
|
121
|
-
let value = cell_value;
|
|
122
|
-
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
120
|
+
if(cell_value)
|
|
123
121
|
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
cell_value = cell_value.toString();
|
|
123
|
+
let value = cell_value;
|
|
124
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
125
|
+
{
|
|
126
|
+
let a = [];
|
|
127
|
+
a.push(cell_value.substr(6, 2));
|
|
128
|
+
a.push(cell_value.substr(4, 2));
|
|
129
|
+
a.push(cell_value.substr(0, 4));
|
|
130
|
+
value = a.join(seperator);
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
else
|
|
135
|
+
{
|
|
136
|
+
return cell_value;
|
|
137
|
+
}
|
|
131
138
|
};
|
|
132
139
|
}
|
|
133
140
|
}
|
|
@@ -135,6 +142,33 @@ console.log(_data);
|
|
|
135
142
|
}
|
|
136
143
|
|
|
137
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Add HTML Formatter
|
|
147
|
+
@alias module:Jqgrid_utils
|
|
148
|
+
@param {array} - grid col_model
|
|
149
|
+
@param {string} - string columns names what will be converted to ok buttons
|
|
150
|
+
@param {string} - html tag code
|
|
151
|
+
@returns {array} - col_model
|
|
152
|
+
@example
|
|
153
|
+
var jqu = new Jqgrid_utils();
|
|
154
|
+
col_model = await jqu.add_html_formatter(col_model,'process',"<button tabindex='0' class='cellbtn' type='button'>Process</button>");
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
async add_html_formatter(col_model, edit_field, html)
|
|
158
|
+
{
|
|
159
|
+
for(let i=0;i< col_model.length;i++)
|
|
160
|
+
{
|
|
161
|
+
if(col_model[i]['name'] === edit_field)
|
|
162
|
+
{
|
|
163
|
+
col_model[i]['formatter'] = function (cell_val,o)
|
|
164
|
+
{
|
|
165
|
+
return html;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return col_model;
|
|
170
|
+
}
|
|
171
|
+
|
|
138
172
|
/**
|
|
139
173
|
* Add an OK Button
|
|
140
174
|
@alias module:Jqgrid_utils
|
|
@@ -168,7 +202,7 @@ async add_ok_button(col_model, fields)
|
|
|
168
202
|
}
|
|
169
203
|
return col_model;
|
|
170
204
|
}
|
|
171
|
-
|
|
205
|
+
|
|
172
206
|
|
|
173
207
|
|
|
174
208
|
/**
|
package/jqgrid_utils.js
CHANGED
|
@@ -116,17 +116,24 @@ console.log(_data);
|
|
|
116
116
|
{
|
|
117
117
|
col_model[i]['formatter'] = function (cell_value, o)
|
|
118
118
|
{
|
|
119
|
-
cell_value
|
|
120
|
-
let value = cell_value;
|
|
121
|
-
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
119
|
+
if(cell_value)
|
|
122
120
|
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
cell_value = cell_value.toString();
|
|
122
|
+
let value = cell_value;
|
|
123
|
+
if(cell_value.length >= 8 && cell_value.indexOf(seperator) === -1)
|
|
124
|
+
{
|
|
125
|
+
let a = [];
|
|
126
|
+
a.push(cell_value.substr(6, 2));
|
|
127
|
+
a.push(cell_value.substr(4, 2));
|
|
128
|
+
a.push(cell_value.substr(0, 4));
|
|
129
|
+
value = a.join(seperator);
|
|
130
|
+
}
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
else
|
|
134
|
+
{
|
|
135
|
+
return cell_value;
|
|
136
|
+
}
|
|
130
137
|
};
|
|
131
138
|
}
|
|
132
139
|
}
|
|
@@ -134,6 +141,33 @@ console.log(_data);
|
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Add HTML Formatter
|
|
146
|
+
@alias module:Jqgrid_utils
|
|
147
|
+
@param {array} - grid col_model
|
|
148
|
+
@param {string} - string columns names what will be converted to ok buttons
|
|
149
|
+
@param {string} - html tag code
|
|
150
|
+
@returns {array} - col_model
|
|
151
|
+
@example
|
|
152
|
+
var jqu = new Jqgrid_utils();
|
|
153
|
+
col_model = await jqu.add_html_formatter(col_model,'process',"<button tabindex='0' class='cellbtn' type='button'>Process</button>");
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
async add_html_formatter(col_model, edit_field, html)
|
|
157
|
+
{
|
|
158
|
+
for(let i=0;i< col_model.length;i++)
|
|
159
|
+
{
|
|
160
|
+
if(col_model[i]['name'] === edit_field)
|
|
161
|
+
{
|
|
162
|
+
col_model[i]['formatter'] = function (cell_val,o)
|
|
163
|
+
{
|
|
164
|
+
return html;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return col_model;
|
|
169
|
+
}
|
|
170
|
+
|
|
137
171
|
/**
|
|
138
172
|
* Add an OK Button
|
|
139
173
|
@alias module:Jqgrid_utils
|
|
@@ -167,7 +201,7 @@ async add_ok_button(col_model, fields)
|
|
|
167
201
|
}
|
|
168
202
|
return col_model;
|
|
169
203
|
}
|
|
170
|
-
|
|
204
|
+
|
|
171
205
|
|
|
172
206
|
|
|
173
207
|
/**
|
package/package.json
CHANGED