2014-02-11 97 views
0

我正在使用jqxgrid小部件,它是一個jQuery網格小部件。過濾器下拉列表超出了jqxgrid中的過濾器彈出框

我發現過濾器條件下拉菜單超出了過濾器彈出窗口,這導致過濾器彈出窗口自動關閉,如果我單擊過濾條件下拉菜單中的最後一項。 因此,在條件下拉菜單中使用最後一項時,無法進行過濾。你可以在附上的屏幕截圖中看到它。由於這個原因,我無法過濾null或不爲空條件。

我該如何預防?

Filtering Issue

代碼jqxGrid如下所示。

  $("#jqxgrid").jqxGrid({ 
      theme: 'ui-start', 
      width: 740, 
      source: dataAdapter, 
      pageable: true, 
      sortable: true, 
      filterable: true, 
      autoheight: true, 
      virtualmode: true, 
      rendergridrows: function (args) { 
       return args.data; 
      }, 
      updatefilterconditions: function (type, defaultconditions) { 
       var stringcomparisonoperators = ['EMPTY', 'NOT_EMPTY', 'CONTAINS', 
       'DOES_NOT_CONTAIN', 'STARTS_WITH', 
       'ENDS_WITH', 'EQUAL', 'NULL', 'NOT_NULL']; 
       var numericcomparisonoperators = ['EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL']; 
       var datecomparisonoperators = ['EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL']; 
       var booleancomparisonoperators = ['EQUAL', 'NOT_EQUAL']; 
       switch (type) { 
        case 'stringfilter': 
         return stringcomparisonoperators; 
        case 'numericfilter': 
         return numericcomparisonoperators; 
        case 'datefilter': 
         return datecomparisonoperators; 
        case 'booleanfilter': 
         return booleancomparisonoperators; 
       } 
      }, 

      updatefilterpanel: function (filtertypedropdown1, filtertypedropdown2, filteroperatordropdown, filterinputfield1, filterinputfield2, filterbutton, clearbutton, 
      columnfilter, filtertype, filterconditions) { 
       var index1 = 0; 
       var index2 = 0; 
       if (columnfilter != null) { 
        var filter1 = columnfilter.getfilterat(0); 
        var filter2 = columnfilter.getfilterat(1); 
        if (filter1) { 
         index1 = filterconditions.indexOf(filter1.comparisonoperator); 
         var value1 = filter1.filtervalue; 
         filterinputfield1.val(value1); 
        } 
        if (filter2) { 
         index2 = filterconditions.indexOf(filter2.comparisonoperator); 
         var value2 = filter2.filtervalue; 
         filterinputfield2.val(value2); 
        } 
       } 
       filtertypedropdown1.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index1 }); 
       filtertypedropdown2.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index2 }); 
      }, 
      columns: [ 
       { text: 'Sales Order ID', dataField: 'SalesOrderID', width: 120 }, 
       { text: 'Sales Order Number', dataField: 'SalesOrderNumber', width: 120 }, 
       { text: 'Purchase Order Number', dataField: 'PurchaseOrderNumber', width: 120 }, 
       { text: 'Customer ID', dataField: 'CustomerID', width: 120 }, 
       { text: 'Order Date', dataField: 'OrderDate', width: 130, cellsformat: 'MM-dd-yyyy' }, 
       { text: 'Due Date', dataField: 'DueDate', width: 130, cellsformat: 'MM-dd-yyyy' } 
      ] 
     }); 

回答

0

看來,詳細記下您的問題有時可能突然提供您的解決方案和答案。就我而言,它的確如此。

我已經在我的代碼,這實際上必須設置爲false設置autoDropDownHeight爲true

正確的代碼應該如下。

filtertypedropdown1.jqxDropDownList({ autoDropDownHeight: false, selectedIndex: index1 }); 
filtertypedropdown2.jqxDropDownList({ autoDropDownHeight: false, selectedIndex: index2 });