2015-09-02 70 views
3

我是新手劍道網格。下面的代碼無法過濾例子中出現的第二個單詞:如果我開始在文本框中鍵入「Vins」,它會正確預測並在下拉列表中顯示此「Vins et alcools Chevalier」,但如果我鍵入「et」 「,」alcools「......它沒有預測,也沒有顯示在下拉菜單中。無法過濾劍道網格中的文本框

來源:http://dojo.telerik.com/UFozA

<!DOCTYPE html> 
    <html> 
    <head> 
     <base href="http://demos.telerik.com/kendo-ui/grid/filter-row"> 
     <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style> 
     <title></title> 
     <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2015.2.902/styles/kendo.common-material.min.css" /> 
     <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2015.2.902/styles/kendo.material.min.css" /> 

     <script src="https://kendo.cdn.telerik.com/2015.2.902/js/jquery.min.js"></script> 
     <script src="https://kendo.cdn.telerik.com/2015.2.902/js/kendo.all.min.js"></script> 
    </head> 
    <body> 

      <div id="example"> 
       <div id="grid"></div> 
       <script> 
        $(document).ready(function() { 
         $("#grid").kendoGrid({ 
          dataSource: { 
           type: "odata", 
           transport: { 
            read: "//demos.telerik.com/kendo-ui/service/Northwind.svc/Orders" 
           }, 
           schema: { 
            model: { 
             fields: { 
              OrderID: { type: "number" }, 
              Freight: { type: "number" }, 
              ShipName: { type: "string" }, 
              OrderDate: { type: "date" }, 
              ShipCity: { type: "string" } 
             } 
            } 
           }, 
           pageSize: 20, 
           serverPaging: true, 
           //filter: "contains", 
           serverFiltering: true, 
          }, 
          height: 550, 
          filterable: { 
           mode: "row" 
          }, 
          pageable: true, 
          filter: "contains", 
          columns: 
          [{ 
           field: "OrderID", 
           width: 225, 
           filterable: { 
            cell: { 
             showOperators: false 
            } 
           } 
          }, 
          { 
           field: "ShipName", 
           width: 500, 
           title: "Ship Name", 
           filterable: { 
            cell: { 
             operator: "contains" 
            } 
           } 
          },{ 
           field: "Freight", 
           width: 255, 
           filterable: { 
            cell: { 
             operator: "gte" 
            } 
           } 
          },{ 
           field: "OrderDate", 
           title: "Order Date", 
           format: "{0:MM/dd/yyyy}" 
          }] 
         }); 
        }); 
       </script> 
      </div> 


    </body> 
    </html> 

回答

1

試試這個:http://dojo.telerik.com/@smagistri/UGerE

實際上,你還需要增加:

cell: { 
     template: function (container) { 
     container.element.kendoAutoComplete({ 
      filter: "contains", 
      //autoBind: false, 
      dataTextField: "ShipName", 
      dataValueField: "ShipName", 
      valuePrimitive: true, 
      dataSource: container.dataSource 
     }); 
    }, 
    showOperators: false 
} 
+0

由於其工作的偉大! – iCherukuri