kendo autocomplete on numeric field -
trying use autocomplete datatextfield integer. keep getting "tolower" or "indexof" error. cant find single example of trying autocomplete numbers.
ps: works fine text field
$("#autocomplete").kendoautocomplete({ datatextfield: "value", select: function(e) { var dataitem = this.dataitem(e.item.index()); //output selected dataitem $("#result").html(kendo.dataitem); }, datasource: { data: [ { id : 1, value: 1 }, { id : 2, value: 2 }, { id : 3, value: 3 }, { id : 4, value: 4 } ] } });
as workaround, can try adding tolowercase()
prototype number
$(document).ready(function() { if (!number.prototype.tolowercase) { number.prototype.tolowercase = function() { return this.tostring(); } } });
$(document).ready(function() { if (!number.prototype.tolowercase) { number.prototype.tolowercase = function() { return this.tostring(); } } }); $("#autocomplete").kendoautocomplete({ datatextfield: "value", select: function(e) { var dataitem = this.dataitem(e.item.index()); //output selected dataitem $("#result").html(kendo.dataitem); }, datasource: { data: [{ id: 1, value: 1 }, { id: 2, value: 2 }, { id: 3, value: 3 }, { id: 4, value: 4 }] } });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.common.min.css" rel="stylesheet" /> <script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script> <input id="autocomplete" /> <div id="result"></div>
Comments
Post a Comment