jqgrid_utils 1.33.0 → 1.34.1

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
  }
@@ -1503,6 +1553,7 @@ var jqu = new Jqgrid_utils();
1503
1553
  */
1504
1554
  async set_styles(obj, style_column = "styles") {
1505
1555
  const rows = jQuery(obj).jqGrid("getGridParam", "data");
1556
+
1506
1557
  for (let i in rows) {
1507
1558
  if (rows[i][style_column]) {
1508
1559
  const styles = JSON.parse(rows[i][style_column]);
@@ -1510,7 +1561,7 @@ var jqu = new Jqgrid_utils();
1510
1561
  const rowid = rows[i]["id"];
1511
1562
  const name = ii;
1512
1563
  if (rows[i].hasOwnProperty(name)) {
1513
- jQuery("#grid").jqGrid("setCell", rowid, name, "", styles[ii]);
1564
+ jQuery(obj).jqGrid("setCell", rowid, name, "", styles[ii]);
1514
1565
  }
1515
1566
  }
1516
1567
  }
@@ -1575,7 +1626,7 @@ col_model = await jqu.add_link_details(col_model, host + '/html/table_size.html'
1575
1626
  }
1576
1627
  const _cell_val = self.__cell_format(cell_val, format);
1577
1628
 
1578
- if (t != "") {
1629
+ if (t != "" && _cell_val && t) {
1579
1630
  cell_val =
1580
1631
  "<a " +
1581
1632
  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
  }
@@ -1502,6 +1552,7 @@ var jqu = new Jqgrid_utils();
1502
1552
  */
1503
1553
  async set_styles(obj, style_column = "styles") {
1504
1554
  const rows = jQuery(obj).jqGrid("getGridParam", "data");
1555
+
1505
1556
  for (let i in rows) {
1506
1557
  if (rows[i][style_column]) {
1507
1558
  const styles = JSON.parse(rows[i][style_column]);
@@ -1509,7 +1560,7 @@ var jqu = new Jqgrid_utils();
1509
1560
  const rowid = rows[i]["id"];
1510
1561
  const name = ii;
1511
1562
  if (rows[i].hasOwnProperty(name)) {
1512
- jQuery("#grid").jqGrid("setCell", rowid, name, "", styles[ii]);
1563
+ jQuery(obj).jqGrid("setCell", rowid, name, "", styles[ii]);
1513
1564
  }
1514
1565
  }
1515
1566
  }
@@ -1574,7 +1625,7 @@ col_model = await jqu.add_link_details(col_model, host + '/html/table_size.html'
1574
1625
  }
1575
1626
  const _cell_val = self.__cell_format(cell_val, format);
1576
1627
 
1577
- if (t != "") {
1628
+ if (t != "" && _cell_val && t) {
1578
1629
  cell_val =
1579
1630
  "<a " +
1580
1631
  attr +
package/package.json CHANGED
@@ -30,6 +30,8 @@
30
30
  "test": "echo \"Error: no test specified\" && exit 1"
31
31
  },
32
32
 
33
- "version": "1.33.0"
33
+ "version": "1.34.1"
34
+
35
+
34
36
 
35
37
  }