or
I'm trying to make an autocomplete and I'm using Visual Studio for debugging. The autocomplete does ask for data, my code returns it then I get this from Visual Studio:
Microsoft JScript runtime error: Unable to get value of the property 'toLowerCase': object is null or undefined
function anonymous(d, __f, __o) {
return (d.Title.toLowerCase().lastIndexOf('key', 0) == 0)
}
I'm guessing it is due to d.Title being undefined... BTW: key above was the search word typed into the autocomplete.
I'm creating the autocomplete like this:
// Search box.
$(
"#searchBox"
).kendoAutoComplete({
minLength: 3,
dataTextField:
"Title"
,
//JSON property name to use
dataSource:
new
kendo.data.DataSource({
type:
"json"
,
//Specifies data protocol
pageSize: 10,
//Limits result set
transport: {
read:
"/Search"
,
parameterMap:
function
() {
return
{ title: $(
"#searchBox"
).data(
"kendoAutoComplete"
).value() };
}
}
})
});
Here is the data returned:
[{"Title":"Doctor Who: The Trial of a Time Lord"},{"Title":"Doctor Who: The Key to Time"},{"Title":"Doctor Who: The Time Meddler"},{"Title":"Doctor Who: The End of Time"}]
<script>
function
createGauges() {
$(
"#depthBar"
).kendoLinearGauge({
pointer: {
value: 0,
shape:
"arrow"
},
scale: {
majorUnit: 1000,
minorUnit: 500,
min: 0,
max: 12000,
vertical:
true
,
}
});
}
$(document).ready(
function
() {
createGauges();
});
</script>
columns.Bound(e => e.DisplayText).Title("ACTION").Template(
@<
text
>
@if (item.UserClient.IsActionAvailable())
{
using (Html.BeginForm("Subscribe", "eServices", FormMethod.Post, new {id = @formId}))
{
<
div
id
=
"@divId"
class
=
"subForm"
>
<
input
type
=
"hidden"
name
=
"User"
value
=
"@clientId"
/>
</
div
>
}