jqgrid_utils 1.25.0 → 1.26.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.
@@ -683,18 +683,39 @@ console.log(_data);
683
683
 
684
684
 
685
685
  /**
686
- * Hide a col_model column before load the grid
686
+ * Hide all columns execpt column
687
687
  * @alias module:Jqgrid_utils
688
688
  * @param {object} - col_model of the grid
689
- * @param {string} - name of the column to hide
689
+ * @param {array} - array of names to not to hide
690
690
  * @returns {object} col_model
691
691
  * @example
692
- if(filter['_filter'] == 'ch_p_higher_ch_plus_10pc')
692
+ col_model = await jqu.hide_all_columns_except(col_model,['supplier','customer']);
693
+ */
694
+ async hide_all_columns_except(col_model,fields)
695
+ {
696
+ for(let i=0;i< col_model.length;i++)
693
697
  {
694
- col_model = await jqu.hide_column(col_model,'wholesale');
695
- col_model = await jqu.hide_column(col_model,'wholesale_formula');
698
+ if( fields.indexOf(col_model[i]['name']) > -1)
699
+ {
700
+ col_model[i]['hidden'] = false;
701
+ }
702
+ else
703
+ {
704
+ col_model[i]['hidden'] = true;
705
+ }
696
706
  }
707
+ return col_model;
708
+ }
697
709
 
710
+ /**
711
+ * Hide a col_model column before load the grid
712
+ * @alias module:Jqgrid_utils
713
+ * @param {object} - col_model of the grid
714
+ * @param {string} - name of the column to hide
715
+ * @returns {object} col_model
716
+ * @example
717
+ col_model = await jqu.hide_column(col_model,'wholesale');
718
+ col_model = await jqu.hide_column(col_model,'wholesale_formula');
698
719
  */
699
720
  async hide_column(col_model,field)
700
721
  {
@@ -702,7 +723,6 @@ console.log(_data);
702
723
  {
703
724
  if(col_model[i]['name'] === field)
704
725
  {
705
- console.log("fffffffF");
706
726
  col_model[i]['hidden'] = true;
707
727
  }
708
728
  }
package/jqgrid_utils.js CHANGED
@@ -682,18 +682,39 @@ console.log(_data);
682
682
 
683
683
 
684
684
  /**
685
- * Hide a col_model column before load the grid
685
+ * Hide all columns execpt column
686
686
  * @alias module:Jqgrid_utils
687
687
  * @param {object} - col_model of the grid
688
- * @param {string} - name of the column to hide
688
+ * @param {array} - array of names to not to hide
689
689
  * @returns {object} col_model
690
690
  * @example
691
- if(filter['_filter'] == 'ch_p_higher_ch_plus_10pc')
691
+ col_model = await jqu.hide_all_columns_except(col_model,['supplier','customer']);
692
+ */
693
+ async hide_all_columns_except(col_model,fields)
694
+ {
695
+ for(let i=0;i< col_model.length;i++)
692
696
  {
693
- col_model = await jqu.hide_column(col_model,'wholesale');
694
- col_model = await jqu.hide_column(col_model,'wholesale_formula');
697
+ if( fields.indexOf(col_model[i]['name']) > -1)
698
+ {
699
+ col_model[i]['hidden'] = false;
700
+ }
701
+ else
702
+ {
703
+ col_model[i]['hidden'] = true;
704
+ }
695
705
  }
706
+ return col_model;
707
+ }
696
708
 
709
+ /**
710
+ * Hide a col_model column before load the grid
711
+ * @alias module:Jqgrid_utils
712
+ * @param {object} - col_model of the grid
713
+ * @param {string} - name of the column to hide
714
+ * @returns {object} col_model
715
+ * @example
716
+ col_model = await jqu.hide_column(col_model,'wholesale');
717
+ col_model = await jqu.hide_column(col_model,'wholesale_formula');
697
718
  */
698
719
  async hide_column(col_model,field)
699
720
  {
@@ -701,7 +722,6 @@ console.log(_data);
701
722
  {
702
723
  if(col_model[i]['name'] === field)
703
724
  {
704
- console.log("fffffffF");
705
725
  col_model[i]['hidden'] = true;
706
726
  }
707
727
  }
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.25.0"
32
+ "version": "1.26.0"
33
33
  }