jqgrid_utils 1.26.2 → 1.26.4

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.
@@ -1249,7 +1249,8 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
1249
1249
  if (col_model[i]['name'] === edit_field)
1250
1250
  {
1251
1251
  col_model[i]['formatter'] = function(cell_val, obj)
1252
- {
1252
+ {
1253
+ cell_val = String(cell_val);
1253
1254
  let key_val = '';
1254
1255
  if(cell_val)
1255
1256
  {
@@ -1257,8 +1258,9 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
1257
1258
  }
1258
1259
  let t = '';
1259
1260
  if(cell_val) {
1260
- t = cell_val.toString();
1261
+ t = cell_val.toString();
1261
1262
  }
1263
+
1262
1264
  if (typeof keys === 'object')
1263
1265
  {
1264
1266
  let pref = '';
@@ -1289,6 +1291,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
1289
1291
  pref = pref.slice(0, -1);
1290
1292
  }
1291
1293
  const _cell_val = self.__cell_format(cell_val, format);
1294
+
1292
1295
  if(t !='')
1293
1296
  {
1294
1297
  cell_val = '<a ' + attr + 'href="' + url + pref + '"> ' + _cell_val + '</a>';
@@ -1553,7 +1556,7 @@ async subgrid(_id, id, url, col_model, caption='' )
1553
1556
  @param {int} - size of the picture
1554
1557
  @param {bolen} - image path should be a link
1555
1558
  @example
1556
- col_model = await jqu.add_image(col_model, 'image', 60, false);
1559
+ col_model = await jqu.add_image(col_model, image_field, 60, false);
1557
1560
  */
1558
1561
  async add_image(col_model, edit_field, size, link=false)
1559
1562
  {
@@ -1564,22 +1567,23 @@ async add_image(col_model, edit_field, size, link=false)
1564
1567
  for (let i = 0; i < col_model.length; i++)
1565
1568
  {
1566
1569
  if (col_model[i]['name'] === edit_field)
1567
- {
1570
+ {
1568
1571
  col_model[i]['picture'] = true;
1569
1572
  col_model[i]['width'] = size;
1570
1573
  col_model[i]['height'] = size;
1571
1574
  col_model[i]['formatter'] = function(cell_val)
1572
1575
  {
1573
- const cell_val2 = cell_val.toLowerCase();
1576
+ const cell_val2 = cell_val.toLowerCase();
1577
+
1574
1578
  if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
1575
1579
  {
1576
- if(cell_val2.endsWith(".png") ||
1577
- cell_val2.endsWith(".jpg") ||
1578
- cell_val2.endsWith(".jpeg") ||
1579
- cell_val2.endsWith(".gif") ||
1580
- cell_val2.endsWith(".svg") ||
1581
- cell_val2.endsWith(".svgz") ||
1582
- cell_val2.endsWith(".webp"))
1580
+ if(cell_val2.includes(".png") ||
1581
+ cell_val2.includes(".jpg") ||
1582
+ cell_val2.includes(".jpeg") ||
1583
+ cell_val2.includes(".gif") ||
1584
+ cell_val2.includes(".svg") ||
1585
+ cell_val2.includes(".svgz") ||
1586
+ cell_val2.includes(".webp"))
1583
1587
  {
1584
1588
  if(link)
1585
1589
  {
package/jqgrid_utils.js CHANGED
@@ -1248,7 +1248,8 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
1248
1248
  if (col_model[i]['name'] === edit_field)
1249
1249
  {
1250
1250
  col_model[i]['formatter'] = function(cell_val, obj)
1251
- {
1251
+ {
1252
+ cell_val = String(cell_val);
1252
1253
  let key_val = '';
1253
1254
  if(cell_val)
1254
1255
  {
@@ -1256,8 +1257,9 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
1256
1257
  }
1257
1258
  let t = '';
1258
1259
  if(cell_val) {
1259
- t = cell_val.toString();
1260
+ t = cell_val.toString();
1260
1261
  }
1262
+
1261
1263
  if (typeof keys === 'object')
1262
1264
  {
1263
1265
  let pref = '';
@@ -1288,6 +1290,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
1288
1290
  pref = pref.slice(0, -1);
1289
1291
  }
1290
1292
  const _cell_val = self.__cell_format(cell_val, format);
1293
+
1291
1294
  if(t !='')
1292
1295
  {
1293
1296
  cell_val = '<a ' + attr + 'href="' + url + pref + '"> ' + _cell_val + '</a>';
@@ -1552,7 +1555,7 @@ async subgrid(_id, id, url, col_model, caption='' )
1552
1555
  @param {int} - size of the picture
1553
1556
  @param {bolen} - image path should be a link
1554
1557
  @example
1555
- col_model = await jqu.add_image(col_model, 'image', 60, false);
1558
+ col_model = await jqu.add_image(col_model, image_field, 60, false);
1556
1559
  */
1557
1560
  async add_image(col_model, edit_field, size, link=false)
1558
1561
  {
@@ -1563,22 +1566,23 @@ async add_image(col_model, edit_field, size, link=false)
1563
1566
  for (let i = 0; i < col_model.length; i++)
1564
1567
  {
1565
1568
  if (col_model[i]['name'] === edit_field)
1566
- {
1569
+ {
1567
1570
  col_model[i]['picture'] = true;
1568
1571
  col_model[i]['width'] = size;
1569
1572
  col_model[i]['height'] = size;
1570
1573
  col_model[i]['formatter'] = function(cell_val)
1571
1574
  {
1572
- const cell_val2 = cell_val.toLowerCase();
1575
+ const cell_val2 = cell_val.toLowerCase();
1576
+
1573
1577
  if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
1574
1578
  {
1575
- if(cell_val2.endsWith(".png") ||
1576
- cell_val2.endsWith(".jpg") ||
1577
- cell_val2.endsWith(".jpeg") ||
1578
- cell_val2.endsWith(".gif") ||
1579
- cell_val2.endsWith(".svg") ||
1580
- cell_val2.endsWith(".svgz") ||
1581
- cell_val2.endsWith(".webp"))
1579
+ if(cell_val2.includes(".png") ||
1580
+ cell_val2.includes(".jpg") ||
1581
+ cell_val2.includes(".jpeg") ||
1582
+ cell_val2.includes(".gif") ||
1583
+ cell_val2.includes(".svg") ||
1584
+ cell_val2.includes(".svgz") ||
1585
+ cell_val2.includes(".webp"))
1582
1586
  {
1583
1587
  if(link)
1584
1588
  {
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.26.2"
32
+ "version": "1.26.4"
33
33
  }