Andrus
Andrus

Reputation: 27931

how to reorder columns in jqgrid by dragging column headers

jqgrid doc in here contains:

method allow to reorder the grid columns using the mouse. The only necessary setting in this case is to set the sortable option in jqGrid to true.

I have sortable: true but columns cannot reordered by dragging headers by mouse. How to re-order columns by dragging columns headers or other way without using column chooser ?

Upvotes: 1

Views: 11429

Answers (1)

Oleg
Oleg

Reputation: 221997

To implement sortable columns is really easy. You should just follow the documentation. You should just

  1. include jquery-ui.min.js additionally to jquery-ui.css which are always required. The most people have the file already included because of usage jQuery UI Widgets like Datepicker, Autocomplete, Tabs and so on.
  2. add sortable: true option to the grid.

Now you can already (see the demo) drag the column header and drop it on another position.

Upvotes: 6

Related Questions