Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is a call in grid.jqueryui.js (jqGrid v3.8.2) in update() to ts.p.sortable.update() as discussed on the <a href="http://www.trirand.com/blog/?page_id=393/help/sortable-columns/">jqGrid message board</a>, so:</p> <pre><code>jQuery('#gridId').jqGrid({ ..., sortable: { update: function(permutation) { alert('save permutation somewhere'); }, ... }); </code></pre> <p>However, please note that the array passed to your callback will be relative to the current column order. In other words, saving the array as is after moving multiple columns will not produce the desired results.</p> <p>I had to do something like this:</p> <pre><code>var defaultColNames = [ 'Alpha', 'Beta', 'Gamma' ]; var defaultColModel = [ { name: 'alpha', index: 'alpha' }, { name: 'beta', index: 'beta' }, { name: 'gamma', index: 'gamma' } ]; jQuery('#gridId').jqGrid({ ..., colNames: defaultColNames, colModel: defaultColModel, sortable: { update: function(relativeColumnOrder) { var grid = jQuery('#gridId'); var defaultColIndicies = []; for( var i=0; i&lt;defaultColModel.length; i++ ) { defaultColIndicies.push(defaultColModel[i].name); } if( grid.getGridParam('treeGrid') ) { // tree grid mode adds 5 extra columns defaultColIndicies = defaultColIndicies.concat(['level','parent','isLeaf','expanded','loaded']); } var columnOrder = []; var currentColModel = grid.getGridParam('colModel'); for( var j=0; j&lt;relativeColumnOrder.length; j++ ) { columnOrder.push(defaultColIndicies.indexOf(currentColModel[j].name)); } // columnOrder now contains exactly what's necessary to pass to to remapColumns // now save columnOrder somewhere globalColumnOrder = columnOrder; }, ... }); // grab saved column order from cookie or something var globalColumnOrder = [0,1,2]; // append to array if tree grid enabled if( jQuery('#gridId').getGridParam('treeGrid') ) { // tree grid mode adds 5 extra columns for( var k=defaultColNames.length; k&lt;(defaultColNames.length+5); k++ ) { globalColumnOrder.push(k); } } // restore column order jQuery('#gridId').jqGrid('remapColumns', globalColumnOrder, true, false); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload