2017-12-18 4 views
1

Free jqGrid 4.15.0을 사용하고 있으며 세 개의 bool로 채워진 세 개의 확인란 열이 있습니다. 필터 툴바를 사용하면 "모두"선택이 작동하지만 "참"선택은 작동하지만 "거짓"선택은 결코 일치하지 않습니다. 나는 bool을 ints (0, 1)로 변환하고 그에 따라 searchoptions를 설정하려고 시도했지만 bools/ints를 문자열 ("true", "false")로 변환하고 문자열에서 필터링 할 때까지 "False "필터 작동 선택.Free jqGrid 4.15를 사용하면 false에서 체크 상자를 필터링 할 수 없습니다.

확인란이 성공적으로 채우기 만하면 작동하지 않는 필터링입니다.

이 화면은 이전 버전의 jqGrid (4.5.2)를 사용하여 정상적으로 작동했습니다.

누구에게 어떤 아이디어가 있습니까? 당신이 볼 필요가있는 것이 있으면 알려주세요.

public class DelForDetails 
{ 
    public long ScheduleId { get; set; } 
    public DateTime? ShipmentDate { get; set; } 
    public string PurchaseOrderNumber { get; set; } 
    public string ProductNumber { get; set; } 
    public string ScheduleIdentifier { get; set; } 
    public Decimal? ShipmentQuantity { get; set; } 
    public string CommitmentLevel { get; set; } 
    public string ConsumerName { get; set; } 
    public string ShipToFacilityNumber { get; set; } 
    public bool Shipped { get; set; } 
    public bool ExportFlag { get; set; } 
    public bool MissingDateFlag { get; set; } 
    public string StatusForSchedule { get; set; } 
} 

그리드가 :

$('#scheduleGrid').jqGrid({ 
    url: url, 
    datatype: 'json', 
    mtype: 'GET', 
    colModel: [ 
     { name: 'ScheduleId', label: $('#ScheduleIdHeaderText').text(), width: 100, hidden: true, editable: true }, 
     { 
      name: 'ShipmentDate', label: $('#ShipmentDate').text(), width: 100, align: 'center', editable: true, 
      formatter: stdDateFormatter, stype: 'text' 
     }, 
     { name: 'PurchaseOrderNumber', label: $('#PurchaseOrderNumber').text(), width: 150, align: 'left', editable: true }, 
     { name: 'ProductNumber', label: $('#ProductNumber').text(), width: 100, align: 'left', editable: false }, 
     { name: 'ScheduleIdentifier', label: $('#ScheduleIdentifierHeaderText').text(), width: 150, align: 'right', hidden: false }, 
     { 
      name: 'ShipmentQuantity', label: $('#ShipmentQuantity').text(), width: 80, align: 'center', hidden: false, formatter: 'number', 
      formatoptions: { decimalPlaces: 4, thousandsSeparator: '' } 
     }, 
     { name: 'CommitmentLevel', label: $('#CommittmentLevelHeaderText').text(), width: 80, align: 'left', hidden: false }, 
     { name: 'ConsumerName', label: $('#CustomerName').text(), width: 150, align: 'left', hidden: false }, 
     { name: 'ShipToFacilityNumber', label: $('#ShipToCode').text(), width: 100, align: 'center', hidden: false }, 
     { 
      name: 'Shipped', label: $('#ShippedHeaderText').text(), width: 80, align: 'center', hidden: false, formatter: 'checkbox', 
      stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;true:True;false:False' } 
     }, 
     { 
      name: 'ExportFlag', label: $('#ExportFlagHeaderText').text(), width: 80, align: 'center', hidden: false, formatter: 'checkbox', 
      stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;true:True;false:False' } 
     }, 
     { 
      name: 'MissingDateFlag', label: $('#MissingDateFlagHeaderText').text(), width: 80, align: 'center', hidden: false, formatter: 'checkbox', 
      stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;true:True;false:False' } 
     } 
    ], 
    jsonReader: { 
     repeatitems: false, 
     id: 'ScheduleId' 
    }, 
    pager: '#schedulePager', 
    altRows: true, 
    altclass: 'harmony-schedule-grid-altrow-class', 
    ignoreCase: true, 
    multiselect: true, 
    cellEdit: false, 
    rowNum: 15, 
    rowList: [15, 30, 50], 
    loadonce: true, 
    loadui: 'disable', 
    sortable: true, 
    sortname: 'ShipmentDate', 
    sortorder: 'asc', 
    viewrecords: true, 
    gridview: true, 
    autoencode: true, 
    height: 'auto', 
    autowidth: true, 
    subGrid: true, 
    loadComplete: function() { 
     $('#LoadingPanel').hide(); 
     $('td[aria-describedby="scheduleGrid_subgrid"]').addClass('harmony-schedule-background-color'); 
     $('td[aria-describedby="scheduleGrid_cb"]').addClass('harmony-schedule-background-color'); 
    }, 
    subGridRowExpanded: function (subgrid_id, row_id) { 
     ... 
    } 
}) 
.navGrid('#schedulePager', { del: false, add: false, edit: false, search: false }) 
.navButtonAdd('#schedulePager', { } }) 
.filterToolbar({ stringResult: true, searchOnEnter: false, autosearchDelay: 1000, defaultSearch: 'cn' }); 

View of checkboxes

답변

0

내가 정확하게 문제를 이해한다면, 당신은 추가해야 JSON'd하고 그리드에 전달

내 클래스

sorttype: "boolean" 

열에있는 속성.이 데이터는 부울로 해석되어야합니다. 그것은 당신의 문제를 해결해야합니다.

또는 당신 stype: "checkbox" 대신 stype: "select"를 사용하는

stype: 'select', 
searchoptions: { 
    sopt: ['eq', 'ne'], 
    value: ':All;true:True;false:False' 
} 

sorttype: "boolean", 
stype: "checkbox", 
searchoptions: { 
    sopt: ["eq"], 
    value: "true:false" 
} 

에 변경을 고려할 수 있습니다. 짧은 형식의 열 선언 template: "booleanCheckbox"을 사용할 수 있습니다. 그것은 만든 트리 상태 체크 박스에 첫 번째 클릭에 true를 검색 할 수 개인적으로 대부분 template: "booleanCheckbox"firstsortorder: "desc" 속성을 추가

{ 
    name: 'Shipped', label: $('#ShippedHeaderText').text(), width: 80, 
    template: "booleanCheckbox" 
}, 
{ 
    name: 'ExportFlag', label: $('#ExportFlagHeaderText').text(), width: 80, 
    template: "booleanCheckbox" 
} 

{ 
    name: 'Shipped', label: $('#ShippedHeaderText').text(), width: 80, align: 'center', hidden: false, formatter: 'checkbox', 
    stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;true:True;false:False' } 
}, 
{ 
    name: 'ExportFlag', label: $('#ExportFlagHeaderText').text(), width: 80, align: 'center', hidden: false, formatter: 'checkbox', 
    stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;true:True;false:False' } 
} 

에서 열 Shipped의 정의와 ExportFlag을 단순화 할 수 에 의해 stype: "checkbox".

+0

올렉. 어제 도구 모음에서 3 개 상태 확인란을 시도했지만 여전히 문제가 발생했습니다. 이제 "sorttype : boolean"을 추가했습니다. 모두 잘되었습니다. 나는 다른 어떤 예에서도 그것을 보지 못했다. 거기 있었을 지 모르지만 나는 그것을 보지 못했습니다. 다시 한 번 감사드립니다. –

+0

@ GarlandDuvall : 안녕하세요. https://jsfiddle.net/OlegKi/su7ebs65/ 및 https://jsfiddle.net/OlegKi/yvbt6w54/에서 [README4.14.1.md] (https : // github) 데모를 살펴 보는 것이 좋습니다. .com/free-jqgrid/jqGrid/blob/master/README4.14.1.md # new-main-features-in-the-version-4141과 4140과의 비교) 및 [README4.14.0.md] (https://github.com/free-jqgrid/jqGrid/blob/master/README4.14.0.md#new-main-features-implemented-in-the-version-4140-compared-with-4136). 데모는'template : "booleanCheckbox",'generateValue : true','generateDatalist : true' 그리고 좀 더 사용법을 보여줍니다 ... – Oleg

관련 문제