0

I am using jqgrid .

My aim is to view hide columns .I used columnChoser like mentioned below .

$('#Table').jqGrid('columnChooser', {
            done: function (perm) {
                if (perm) {
                    this.jqGrid('remapColumns', perm, true);
                }
            }
        });

Problem : The trouble here is the colums are adding to end of table while restoring. Is there any way to restrore them to same place .

Can someone explain me what is perm ? Is there a way to show only specific colums in the columChoser based on column index like ex: [ 3,4,7]

Any help would be appreciated.

user9074131
  • 63
  • 1
  • 3
  • 12
  • Please include *always* the **version** of jqGrid, which you use (can use), and **the fork** ([free jqGrid](https://github.com/free-jqgrid/jqGrid), commercial [Guriddo jqGrid JS](http://guriddo.net/?page_id=103334) or an old jqGrid in version <=4.7). If you use *correctly* `columnChooser` and you included `ui.multiselect.css`, `jquery-ui.min.js` and `ui.multiselect.js` then one can use drag&drop in columnCooser dialog to reorder the columns. The values in `perm` contains the index of column in the *aktuell* `colModel`. – Oleg Mar 29 '18 at 16:36
  • @Oleg Thanks, I'm using commercial Guriddo jqGrid .I can able to add and remove columns but my issue is upon adding after remove ,the columns are added at end . I want the column to go to same place where it previously was whithout manually dragging it to same place. – user9074131 Mar 29 '18 at 19:50
  • I develop "free jqGrid" fork and have no relation to Guriddo. If you purchased Guriddo jqGrid then you can try contact Guriddo forum http://guriddo.net/?page_id=4 or to wait that Tony Tomov post his answer. The dialog of `columnChooser` allowed to use Drag&Drop. Try the demo http://jsfiddle.net/kbhmg9nq/4/, which uses free jqGrid, open Column Chooser, remove some columns and then use Drag&Drop to move hidden column on the "non-hidden" side. You can use Drag&Drop additionally on the left side to reorder visible columns in the grid. – Oleg Mar 29 '18 at 22:00
  • @Oleg Thank you !! Is there any way to display only specific columns in the columnChooser Dialog ? – user9074131 Mar 29 '18 at 22:16
  • 1
    You are welcome! One can use `hidedlg: true` property in `colModel` to remove some columns from `columnChooser`. For example http://jsfiddle.net/kbhmg9nq/5/ contains `hidedlg: true` in visible column `name` and in the hidden column `note`. Both columns will be not seen in the dialog displayed by `columnChooser`. Additionally free jqGrid provides `buildItemText` callback, which allows to construct the text displayed in column chooser. See the answer https://stackoverflow.com/a/29374787/315935 for demos – Oleg Mar 29 '18 at 22:23

1 Answers1

1

If I understand correct the problem, I'm not sure that the problem can be solved with the current implementation of ColumnChooser. When you try to add visible column (from right to left list), the ColumnChooser add it to the end of list without to care of the original position. I will need to see if this will possible. I will replay to this post. In order to get better support if you use Gurrido jqGrid, I recommend you to write your questions in our public forum here

Tony Tomov
  • 3,122
  • 1
  • 11
  • 18
  • Hi Tony , I am waiting for your reply on whether we can add them to the same position or not ? Thank you !! – user9074131 Apr 09 '18 at 20:44
  • 1
    @user9074131 Unfortunately in order to implement this feature it is needed to change the code of multiselct plugin. There is a implementation of sorting the columns, but not to save the initial order and restore it. Sorry for this, but I'm not sure that I can make this change. – Tony Tomov Apr 10 '18 at 08:56
  • Is there any recent implementation of sorting the columns in the initial order and restore them with same order – user9074131 Dec 17 '18 at 20:48