2016-11-04 1 views
0

filterMenuInit 이벤트가 그리드에서 실행되지 않습니다. AccountNumber 필드에 필터가 있어야하지만 "같음", "포함 안 함"등의 드롭 다운을 완전히 제거하거나 숨기고 싶습니다. 드롭 다운을 제거하는 코드는 filterMenuInit 구성에 있습니다. 그리드가로드 될 때 함수가 실행되지 않습니다. 여기 내 코드는 다음과 같습니다.필터 연산자를 제거하거나 숨기는 방법

<div id="grid"></div> 
    <script> 
     $(document).ready(function() { 
      $("#grid").kendoGrid({ 
       dataSource: { 
        transport: { 
         read: "/api/client" 
        }, 
        schema: { 
         model: { 
          fields: { 
           ClientID: { type: "number" }, 
           Name: { type: "string" }, 
           Branch: { type: "string" }, 
           Department: { type: "string" }, 
           AccountNumber: { type: "number" } 
          } 
         } 
        }, 
        pageSize: 20, 
        serverPaging: false, 
        serverFiltering: false, 
        serverSorting: true 
       }, 
       height: 500, 
       scrollable: true, 
       filterable: { 
        mode: "row", 
        extra: "false" 
       }, 
       filterMenuInit: function(e) { 
        if (e.field === "AccountNumber") { 
        var firstValueDropDown = e.container.find("select:eq(0)").data("kendoDropDownList"); 

         setTimeout(function() { 
          firstValueDropDown.wrapper.hide(); 
         }) 
        } 
       }, 
       sortable: false, 
       pageable: true, 
       columns: [{ 
        field: "AccountNumber", 
        width: "150px", 
        title: "Account #" 
       }, { 
        field: "Branch", 
        filterable: false, 
        width: "100px", 
        title: "Branch" 
       }, { 
        field: "Department", 
        filterable: false, 
        width: "100px", 
        title: "Department" 
       }, { 
        field: "Name", 
        template: '<a href="/client/#=ClientID#">#=Name#</a>', 
        title: "Client Name" 
       }, { 
        filterable: "false", 
        template: '<span class="glyphicon glyphicon-file"></span><a href="/client/#=ClientID#/invoice">View Invoices</a>', 
        width: "150px" 
       }, { 
        filterable: "false", 
        template: '<span class="glyphicon glyphicon-list-alt"></span> <a href="/client/#=ClientID#/workorder">View Work Orders</a>', 
        width: "150px" 
       } 
      ] 
      }); 
     }); 
    </script> 

브라우저에서 디버그 모드가 시작되었으며 이벤트가 실행되지 않으므로 드롭 다운이 활성 상태로 유지됩니다.

당신이 열 정의

filterable: { 
    cell: { 
     showOperators: false 
    } 
} 

에서 다음 코드를 사용하거나 당신이 숫자가 스키마에서 정의 할 수 있습니다

답변

1

, 그것은 여기

뿐만 아니라 그것을 해결할 것은 demo

입니다
관련 문제