2017-02-06 2 views
2
  1. 열을 드래그하여 순서 재 지정을 비활성화하려고하지만 jqGrid는 열을 정렬하여 작동합니다.
  2. 또는 열을 끌어서 열 선택기를 사용하여 재정렬을 활성화하고 싶습니다.

이 코드는 열을 드래그하여 오류가 발생합니다.jqGrid - 어떻게 열을 드래그 할 수 있지만 정렬 할 수있는 열을 비활성화 할 수 있습니다

$(function() { 
    jQuery("#search_datagrid").jqGrid("GridUnload").jqGrid({ 
     url: '/Search/SearchDataGrid/', 
     datatype: "json", 
     contentType: "application/json; charset-utf-8", 
     mtype: 'POST', 
     postData: { 
      search_word: search_word, 
      baseLang: baseLang, 
      targetLang: targetLang, 
      products: products 
     }, 
     rowNum: 20, 
     rowList: [10, 20, 30, 50], 
     colNames: columnNames, 
     colModel: columnModels, 
     shrinkToFit: true, 
     height:'auto', 
     autowidth: true, 
     pager: "#search_pager", 
     viewrecords: true, 
     caption: "Result", 
     subGrid: true, 
     sortable: true, 
     loadonce: true, 
     gridview: true, 

     subGridOptions: { 
      "plusicon": "ui-icon-triangle-1-e", 
      "minusicon": "ui-icon-triangle-1-s", 
      "openicon": "ui-icon-arrowreturn-1-e" 
     }, 
    }) 
    .jqGrid('navGrid', '#search_pager', { add: false, edit: false, del: false, search: false, refresh: false }) 
    .jqGrid('navButtonAdd', '#search_pager', { 
     caption: "Select Columns", 
     title: "Select Columns", 
     buttonicon: "ui-icon-calculator", 
     onClickButton: function() { 
      jQuery("#search_datagrid").jqGrid('columnChooser'); 
     } 
    }) 
    .jqGrid('setGroupHeaders', { 
     useColSpanStyle: true, 
     groupHeaders: [ 
      { startColumnName: '' + baseLang, numberOfColumns: 2, titleText: 'Language' }, 
     ] 
    }) 
}); 
$(window).resize(function() { 
    $("#search_datagrid").setGridWidth($(this).width() - $(this).width()/10); 
}); 

답변

1

사용 그리드 옵션 sortable: true은 드래그 앤 열 머리글의 하락과 관련하여 의 (재 배열)을 의지 할 책임이있다. 다른면에서 colModelsortable: false 속성은 열 머리글을 클릭하여 열에서 데이터의 정렬을 방지하는 데 사용할 수 있습니다. columnChooser에 대한 열 순서 변경은 위의 옵션 및 속성과는 독립적이지만 colModelhidedlg: true 속성을 사용하면 열 선택기 대화 상자에 일부 열이 표시되지 않도록 할 수 있습니다. 내가 제대로 문제를 이해한다면

따라서, 당신은 단지 그리드의 sortable: true을 제거하고 colModel의 내부에 sortable 속성을 지정하지 않아야합니다 (sortable 속성의 기본 값은 데이터 정렬을 허용하는 true입니다).

+0

열을 드래그하여 재정렬하면 작동하지 않으므로 드래그 및 정렬을 사용하지 않도록 설정하는 것이 좋습니다. 고마워, 고마워. – lcy

+0

@lcy : 오신 것을 환영합니다! "열을 드래그하여 순서 변경"이 의미하는 바는 무엇입니까? [데모] (http://www.ok-soft-gmbh.com/jqGrid/OK/formEditOnDoubleClick-jqueryui-fa2.htm)를 시도하십시오. 'jquery-ui.min.js'를 포함 시켰습니까? jqGrid의'sortable : true' 옵션을 사용하면 드래그가 시작된다는 것을 알 수 있습니까? 칼럼의 결과가 잘못 되었습니까? ** 어떤 버전의 jqGrid를 사용하고 어떤 jqGrid ([free jqGrid] (https://github.com/free-jqgrid/jqGrid), 상용 [Guriddo jqGrid JS] (http://guriddo.net/ ? page_id = 103334) 또는 버전 <= 4.7의 이전 jqGrid? ** – Oleg