jqgrid_utils 1.27.2 → 1.28.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/jqgrid_utils.js CHANGED
@@ -24,7 +24,6 @@ module.exports = class Vanilla_website_utils
24
24
  /**
25
25
  * Takes the updated columns data and send it to your API post server
26
26
  * loadComplete: async function() for the old record needs to be called, see example !
27
- * the jgrid ID must be of type string
28
27
  @alias module:Jqgrid_utils
29
28
  @param {object} - Grid Object (required)
30
29
  @param {string} - API URL like https://foo.com (required)
@@ -120,7 +119,7 @@ var jqu = new Jqgrid_utils({page:page});
120
119
  }
121
120
  else if(api != '' && Object.keys(row).length > 0 && row.inputData.oper == 'add')
122
121
  {
123
- //console.log("...add");
122
+ console.log("...add");
124
123
  for(let i in row.inputData)
125
124
  {
126
125
  if(row.inputData[i] && i != 'id' && i != 'oper')
@@ -1184,6 +1183,33 @@ col_model = await jqu.add_link_details_csv(col_model, host + '/html/report.html'
1184
1183
  }
1185
1184
 
1186
1185
 
1186
+ /**
1187
+ * Compare 2 columns and give them a style class when they have different content
1188
+ * http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
1189
+ @alias module:Jqgrid_utils
1190
+ @param {object} - grid object
1191
+ @param {string} - first column
1192
+ @param {string} - second column
1193
+ @param {string} - css class name
1194
+ @example
1195
+ loadComplete: async function()
1196
+ {
1197
+ await jqu.compare(this,'value','value_report','greenlight');
1198
+ }
1199
+
1200
+ */
1201
+ async compare(obj, column1, column2, style)
1202
+ {
1203
+ const rows = jQuery(obj).jqGrid('getGridParam','data');
1204
+ for(let i in rows) {
1205
+ if( rows[i][column1] != rows[i][column2] )
1206
+ {
1207
+ jQuery(obj).jqGrid('setCell',rows[i]['id'], column1, "" ,'greenlight');
1208
+ jQuery(obj).jqGrid('setCell',rows[i]['id'], column2, "" ,'greenlight');
1209
+ }
1210
+ }
1211
+ }
1212
+
1187
1213
  /**
1188
1214
  * Set styles to individual cells, what are defined in a dedicated column
1189
1215
  @alias module:Jqgrid_utils
@@ -1214,7 +1240,7 @@ var jqu = new Jqgrid_utils();
1214
1240
  }
1215
1241
  }
1216
1242
  }
1217
-
1243
+
1218
1244
  }
1219
1245
 
1220
1246
 
@@ -1410,7 +1436,9 @@ var jqu = new Jqgrid_utils();
1410
1436
  'fields':{'style':'style'}
1411
1437
  }
1412
1438
  ]);
1413
-
1439
+ //other example
1440
+ col_model = await jqu.add_link_separator(col_model, 'https://wiki.salamander-jewelry.net/index.php/grid_loss' , 'e',[{'field':'e'}],'target="_blank"');
1441
+
1414
1442
  */
1415
1443
  async add_link_separator(col_model, url, edit_field, fields, attr='')
1416
1444
  {
package/make.sh CHANGED
@@ -1,3 +1 @@
1
- cp npmignore .npmignore
2
-
3
1
  watchify jqgrid_utils.js --s Jqgrid_utils -o dist/jqgrid_utils.js -v
package/make_doc.sh CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/bin/bash
2
+ // install
3
+ // sudo npm install --save-dev jsdoc-to-markdown -g
2
4
 
3
5
  cp _README.md README.md
4
6
  jsdoc2md jqgrid_utils.js >> README.md
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.27.2"
32
+ "version": "1.28.0"
33
33
  }