jqgrid_utils 1.33.0 → 1.34.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.
@@ -1476,16 +1476,66 @@ col_model = await jqu.add_link_details_csv(col_model, host + '/html/report.html'
1476
1476
  @example
1477
1477
  loadComplete: async function()
1478
1478
  {
1479
- await jqu.compare(this,'value','value_report','greenlight');
1479
+ await jqu.compare(this,'first_column','second_column','redlight');
1480
1480
  }
1481
1481
 
1482
1482
  */
1483
- async compare(obj, column1, column2, style) {
1483
+ async compare(obj, column1, column2, css_class) {
1484
1484
  const rows = jQuery(obj).jqGrid("getGridParam", "data");
1485
1485
  for (let i in rows) {
1486
1486
  if (rows[i][column1] != rows[i][column2]) {
1487
- jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", "greenlight");
1488
- jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", "greenlight");
1487
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", css_class);
1488
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", css_class);
1489
+ }
1490
+ }
1491
+ }
1492
+
1493
+ /**
1494
+ * Compare 2 columns for smaller and give them a style class
1495
+ * http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
1496
+ @alias module:Jqgrid_utils
1497
+ @param {object} - grid object
1498
+ @param {string} - first column
1499
+ @param {string} - second column
1500
+ @param {string} - css class name
1501
+ @example
1502
+ loadComplete: async function()
1503
+ {
1504
+ await jqu.compare(this,'first_column','second_column','redlight');
1505
+ }
1506
+
1507
+ */
1508
+ async compare_smaller(obj, column1, column2, css_class) {
1509
+ const rows = jQuery(obj).jqGrid("getGridParam", "data");
1510
+ for (let i in rows) {
1511
+ if (rows[i][column1] < rows[i][column2]) {
1512
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", css_class);
1513
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", css_class);
1514
+ }
1515
+ }
1516
+ }
1517
+
1518
+ /**
1519
+ * Compare 2 columns for bigger and give them a style class
1520
+ * http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
1521
+ @alias module:Jqgrid_utils
1522
+ @param {object} - grid object
1523
+ @param {string} - first column
1524
+ @param {string} - second column
1525
+ @param {string} - css class name
1526
+ @example
1527
+ loadComplete: async function()
1528
+ {
1529
+ await jqu.compare(this,'first_column','second_column','redlight');
1530
+ }
1531
+
1532
+ */
1533
+ async compare_bigger(obj, column1, column2, css_class) {
1534
+ const rows = jQuery(obj).jqGrid("getGridParam", "data");
1535
+ for (let i in rows) {
1536
+ if (rows[i][column1] > rows[i][column2]) {
1537
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", css_class);
1538
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", css_class);
1489
1539
  }
1490
1540
  }
1491
1541
  }
@@ -1575,7 +1625,7 @@ col_model = await jqu.add_link_details(col_model, host + '/html/table_size.html'
1575
1625
  }
1576
1626
  const _cell_val = self.__cell_format(cell_val, format);
1577
1627
 
1578
- if (t != "") {
1628
+ if (t != "" && _cell_val && t) {
1579
1629
  cell_val =
1580
1630
  "<a " +
1581
1631
  attr +
package/jqgrid_utils.js CHANGED
@@ -1475,16 +1475,66 @@ col_model = await jqu.add_link_details_csv(col_model, host + '/html/report.html'
1475
1475
  @example
1476
1476
  loadComplete: async function()
1477
1477
  {
1478
- await jqu.compare(this,'value','value_report','greenlight');
1478
+ await jqu.compare(this,'first_column','second_column','redlight');
1479
1479
  }
1480
1480
 
1481
1481
  */
1482
- async compare(obj, column1, column2, style) {
1482
+ async compare(obj, column1, column2, css_class) {
1483
1483
  const rows = jQuery(obj).jqGrid("getGridParam", "data");
1484
1484
  for (let i in rows) {
1485
1485
  if (rows[i][column1] != rows[i][column2]) {
1486
- jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", "greenlight");
1487
- jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", "greenlight");
1486
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", css_class);
1487
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", css_class);
1488
+ }
1489
+ }
1490
+ }
1491
+
1492
+ /**
1493
+ * Compare 2 columns for smaller and give them a style class
1494
+ * http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
1495
+ @alias module:Jqgrid_utils
1496
+ @param {object} - grid object
1497
+ @param {string} - first column
1498
+ @param {string} - second column
1499
+ @param {string} - css class name
1500
+ @example
1501
+ loadComplete: async function()
1502
+ {
1503
+ await jqu.compare(this,'first_column','second_column','redlight');
1504
+ }
1505
+
1506
+ */
1507
+ async compare_smaller(obj, column1, column2, css_class) {
1508
+ const rows = jQuery(obj).jqGrid("getGridParam", "data");
1509
+ for (let i in rows) {
1510
+ if (rows[i][column1] < rows[i][column2]) {
1511
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", css_class);
1512
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", css_class);
1513
+ }
1514
+ }
1515
+ }
1516
+
1517
+ /**
1518
+ * Compare 2 columns for bigger and give them a style class
1519
+ * http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
1520
+ @alias module:Jqgrid_utils
1521
+ @param {object} - grid object
1522
+ @param {string} - first column
1523
+ @param {string} - second column
1524
+ @param {string} - css class name
1525
+ @example
1526
+ loadComplete: async function()
1527
+ {
1528
+ await jqu.compare(this,'first_column','second_column','redlight');
1529
+ }
1530
+
1531
+ */
1532
+ async compare_bigger(obj, column1, column2, css_class) {
1533
+ const rows = jQuery(obj).jqGrid("getGridParam", "data");
1534
+ for (let i in rows) {
1535
+ if (rows[i][column1] > rows[i][column2]) {
1536
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column1, "", css_class);
1537
+ jQuery(obj).jqGrid("setCell", rows[i]["id"], column2, "", css_class);
1488
1538
  }
1489
1539
  }
1490
1540
  }
@@ -1574,7 +1624,7 @@ col_model = await jqu.add_link_details(col_model, host + '/html/table_size.html'
1574
1624
  }
1575
1625
  const _cell_val = self.__cell_format(cell_val, format);
1576
1626
 
1577
- if (t != "") {
1627
+ if (t != "" && _cell_val && t) {
1578
1628
  cell_val =
1579
1629
  "<a " +
1580
1630
  attr +
package/package.json CHANGED
@@ -30,6 +30,6 @@
30
30
  "test": "echo \"Error: no test specified\" && exit 1"
31
31
  },
32
32
 
33
- "version": "1.33.0"
33
+ "version": "1.34.0"
34
34
 
35
35
  }