JQGrid Column Swap

I have jqgrid and I can change the order of the columns using this option in my JQGrid

    jQuery("#list").jqGrid({
                sortable: true,
                ... 
});

This function allows me to reorder ALL my columns. But I want some columns to be in fixed places. Is there any way to solve this?

Thanks in advance!

Bruno

+3
source share
4 answers

Never say never. jqGrid uses the jQueryUI collation class to execute the drag-n-drop function of a column. http://jqueryui.com/demos/sortable/

To remove a column from the list of sorted columns, run these two commands after rendering your grid (using sortable: true).

// disable the sortable property on your target element 
// (which was applied when jqGrid rendered the grid)
$('tr.ui-jqgrid-labels').sortable({ cancel: 'th:#element_id'});
// update the list of sortable item's, and exclude your target element
$('tr.ui-jqgrid-labels').sortable({ items: "th:not(#element_id)" });

.. , . - .

: , ( ). "sortable: true" , . colmodel "sortable: true" , , . true colmodel. colmodel .

+4

2013 "exclude" "sortable" , :

sortable: {
    exclude: '#'+ grid[0].id +'_actions_buttons'
},
+3

You can set sortablefor each column incolModel

colModel: [{ name: 'name', index: 'name', sortable: true },...

Making documentation is pretty useful.

+1
source

This is not possible in jqgrid. I also searched for this for a long time. And all that I tried failed.

+1
source

Source: https://habr.com/ru/post/1734029/


All Articles