jqgrid_utils 1.5.5 → 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 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> ⏏
@@ -142,6 +142,33 @@ console.log(_data);
142
142
  }
143
143
 
144
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
+
145
172
  /**
146
173
  * Add an OK Button
147
174
  @alias module:Jqgrid_utils
@@ -175,7 +202,7 @@ async add_ok_button(col_model, fields)
175
202
  }
176
203
  return col_model;
177
204
  }
178
-
205
+
179
206
 
180
207
 
181
208
  /**
package/jqgrid_utils.js CHANGED
@@ -141,6 +141,33 @@ console.log(_data);
141
141
  }
142
142
 
143
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
+
144
171
  /**
145
172
  * Add an OK Button
146
173
  @alias module:Jqgrid_utils
@@ -174,7 +201,7 @@ async add_ok_button(col_model, fields)
174
201
  }
175
202
  return col_model;
176
203
  }
177
-
204
+
178
205
 
179
206
 
180
207
  /**
package/package.json CHANGED
@@ -29,5 +29,5 @@
29
29
  {
30
30
  "test": "echo \"Error: no test specified\" && exit 1"
31
31
  },
32
- "version": "1.5.5"
32
+ "version": "1.5.6"
33
33
  }