I have this Kendo Autoplete code:
HTML:
<input id="faceUsers" type="text" placeholder="Search..." data-role="autoplete" autoplete="off" role="textbox" aria-haspopup="true" aria-disabled="false" aria-readonly="false" aria-autoplete="list" aria-busy="false">
JS:
$("#faceUsers").kendoAutoComplete({
dataTextField: "name",
dataValueField: "name",
template: '<img src=\"${data.picture.data.url}\" class="imguser" />' +
'<h4 class="autotext">${ data.name }</h4>',
filter: "contains",
minLength: 1,
height: 370,
dataSource: faceDataSource
});
I have set properly my faceDataSource
and it works as expected.
The problem i am facing is how i can disable this autoplete. After a particular action i want the input
element to behave as a normal input
element without autoplete.
I have this Kendo Autoplete code:
HTML:
<input id="faceUsers" type="text" placeholder="Search..." data-role="autoplete" autoplete="off" role="textbox" aria-haspopup="true" aria-disabled="false" aria-readonly="false" aria-autoplete="list" aria-busy="false">
JS:
$("#faceUsers").kendoAutoComplete({
dataTextField: "name",
dataValueField: "name",
template: '<img src=\"${data.picture.data.url}\" class="imguser" />' +
'<h4 class="autotext">${ data.name }</h4>',
filter: "contains",
minLength: 1,
height: 370,
dataSource: faceDataSource
});
I have set properly my faceDataSource
and it works as expected.
The problem i am facing is how i can disable this autoplete. After a particular action i want the input
element to behave as a normal input
element without autoplete.
3 Answers
Reset to default 8If you want to pletely remove it, use destroy:
$("#autoplete").kendoAutoComplete();
var autoplete = $("#autoplete").data("kendoAutoComplete");
autoplete.destroy();
For your Better Reference just have a look to :: JS Fiddle Demo
As you can see in the Demo example link above the property of suggest
into autoplete is set to on/off
as::
var autoplete = $("#autoplete").kendoAutoComplete({
suggest: true,
dataSource: ["Item1", "2Item"]
}).data("kendoAutoComplete");
And also have a look to
http://www.telerik./forums/turn-off-on-stop-and-start-autoplete-and-suggest-after-init
Another point of view. We can able to do autoplete as read only if we want to disable the editing.
var sampledd= $("#dd").data("kendoAutoComplete");
sampledd.readonly(false);
Disable Suggest
sampledd.suggest(true); // this one causing issue in IE
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743755901a4501753.html
评论列表(0条)