jqgrid_utils 1.26.3 → 1.26.5

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.
@@ -25,6 +25,7 @@ module.exports = class Vanilla_website_utils
25
25
  /**
26
26
  * Takes the updated columns data and send it to your API post server
27
27
  * loadComplete: async function() for the old record needs to be called, see example !
28
+ * the jgrid ID must be of type string
28
29
  @alias module:Jqgrid_utils
29
30
  @param {object} - Grid Object (required)
30
31
  @param {string} - API URL like https://foo.com (required)
@@ -120,7 +121,7 @@ var jqu = new Jqgrid_utils({page:page});
120
121
  }
121
122
  else if(api != '' && Object.keys(row).length > 0 && row.inputData.oper == 'add')
122
123
  {
123
- console.log("...add");
124
+ //console.log("...add");
124
125
  for(let i in row.inputData)
125
126
  {
126
127
  if(row.inputData[i] && i != 'id' && i != 'oper')
@@ -1556,7 +1557,7 @@ async subgrid(_id, id, url, col_model, caption='' )
1556
1557
  @param {int} - size of the picture
1557
1558
  @param {bolen} - image path should be a link
1558
1559
  @example
1559
- col_model = await jqu.add_image(col_model, 'image', 60, false);
1560
+ col_model = await jqu.add_image(col_model, image_field, 60, false);
1560
1561
  */
1561
1562
  async add_image(col_model, edit_field, size, link=false)
1562
1563
  {
@@ -1567,22 +1568,23 @@ async add_image(col_model, edit_field, size, link=false)
1567
1568
  for (let i = 0; i < col_model.length; i++)
1568
1569
  {
1569
1570
  if (col_model[i]['name'] === edit_field)
1570
- {
1571
+ {
1571
1572
  col_model[i]['picture'] = true;
1572
1573
  col_model[i]['width'] = size;
1573
1574
  col_model[i]['height'] = size;
1574
1575
  col_model[i]['formatter'] = function(cell_val)
1575
1576
  {
1576
- const cell_val2 = cell_val.toLowerCase();
1577
+ const cell_val2 = cell_val.toLowerCase();
1578
+
1577
1579
  if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
1578
1580
  {
1579
- if(cell_val2.endsWith(".png") ||
1580
- cell_val2.endsWith(".jpg") ||
1581
- cell_val2.endsWith(".jpeg") ||
1582
- cell_val2.endsWith(".gif") ||
1583
- cell_val2.endsWith(".svg") ||
1584
- cell_val2.endsWith(".svgz") ||
1585
- cell_val2.endsWith(".webp"))
1581
+ if(cell_val2.includes(".png") ||
1582
+ cell_val2.includes(".jpg") ||
1583
+ cell_val2.includes(".jpeg") ||
1584
+ cell_val2.includes(".gif") ||
1585
+ cell_val2.includes(".svg") ||
1586
+ cell_val2.includes(".svgz") ||
1587
+ cell_val2.includes(".webp"))
1586
1588
  {
1587
1589
  if(link)
1588
1590
  {
package/jqgrid_utils.js CHANGED
@@ -24,6 +24,7 @@ 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
27
28
  @alias module:Jqgrid_utils
28
29
  @param {object} - Grid Object (required)
29
30
  @param {string} - API URL like https://foo.com (required)
@@ -119,7 +120,7 @@ var jqu = new Jqgrid_utils({page:page});
119
120
  }
120
121
  else if(api != '' && Object.keys(row).length > 0 && row.inputData.oper == 'add')
121
122
  {
122
- console.log("...add");
123
+ //console.log("...add");
123
124
  for(let i in row.inputData)
124
125
  {
125
126
  if(row.inputData[i] && i != 'id' && i != 'oper')
@@ -1555,7 +1556,7 @@ async subgrid(_id, id, url, col_model, caption='' )
1555
1556
  @param {int} - size of the picture
1556
1557
  @param {bolen} - image path should be a link
1557
1558
  @example
1558
- col_model = await jqu.add_image(col_model, 'image', 60, false);
1559
+ col_model = await jqu.add_image(col_model, image_field, 60, false);
1559
1560
  */
1560
1561
  async add_image(col_model, edit_field, size, link=false)
1561
1562
  {
@@ -1566,22 +1567,23 @@ async add_image(col_model, edit_field, size, link=false)
1566
1567
  for (let i = 0; i < col_model.length; i++)
1567
1568
  {
1568
1569
  if (col_model[i]['name'] === edit_field)
1569
- {
1570
+ {
1570
1571
  col_model[i]['picture'] = true;
1571
1572
  col_model[i]['width'] = size;
1572
1573
  col_model[i]['height'] = size;
1573
1574
  col_model[i]['formatter'] = function(cell_val)
1574
1575
  {
1575
- const cell_val2 = cell_val.toLowerCase();
1576
+ const cell_val2 = cell_val.toLowerCase();
1577
+
1576
1578
  if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
1577
1579
  {
1578
- if(cell_val2.endsWith(".png") ||
1579
- cell_val2.endsWith(".jpg") ||
1580
- cell_val2.endsWith(".jpeg") ||
1581
- cell_val2.endsWith(".gif") ||
1582
- cell_val2.endsWith(".svg") ||
1583
- cell_val2.endsWith(".svgz") ||
1584
- 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"))
1585
1587
  {
1586
1588
  if(link)
1587
1589
  {
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.3"
32
+ "version": "1.26.5"
33
33
  }