I'm using the kendoChart to display the json result from a controller action. The contoller action is getting called, but the page gives an error after that which is shown at the bottom of this message. I tried to catch the dataBound event to see what is happening. The error is happening even before the event, so can't catch it.
An example or help appreciated for this problem.
Controller Action:
...
return Json(itemCount, JsonRequestBehavior.AllowGet);
Script:
$("#liveChart").kendoChart({
...
dataSource: new kendo.data.DataSource({
transport: {
read: {
url: "/Charts/Orders/GetLiveOrdersCount",
dataType: "json"
}
},
schema: {
data: "data"
}
}),
...
Error:
SCRIPT5007: Unable to get value of the property 'length': object is null or undefined
kendo.all.min.js, line 11 character 46965
HTTP/1.1 200 OKdiv.find('input:file').kendoUpload({ async: { saveUrl: '/SomeController/Action', autoUpload: true }, localization: { "uploadSelectedFiles": "Upload Logo" // TODO: load language specific text }, multiple: false, remove: function (files) { var previewElement = $('#' + item.Uid + 'prev'); previewElement.fadeOut('fast', function () { previewElement.html(''); }); }, select: function (files) { if ((window.File && window.FileReader && window.FileList && window.Blob)) { if (files.files.length && files.files.length > 0) { var file = files.files[0]; var previewElement = $('#' + item.Uid + 'prev'); previewElement.previewImage({ 'file': file.rawFile, 'height': 250, 'width': 250, 'title': 'Some Logo' }); } } }, upload: function (evt) { evt.data = { 'Uid': item.Uid }; }, complete: function (evt) { alert('complete'); }, success: function (evt) {Here is the response as seen in the fiddler tool:alert('success');if (evt.operation == 'upload') { var responseData = evt.response; alert(responseData); } }
<script src="http://ajax.aspnetcdn.com/ajax/jQuery.Validate/1.6/jQuery.Validate.min.js" type="text/javascript"></script>
<
script
id
=
"template"
type
=
"text/x-kendo-tmpl"
>
<
tr
>
<
td
>
<
a
href
=
"a"
class
=
"something"
value
=
"#= id #"
>Show ID</
a
>
</
td
>
...
$(document).ready(
function
(){
$(
'.something'
).click(
function
(){
alert($(
this
).attr(
"value"
));
return
false
;
});
...
$(
"#quantity"
).focus();
var
quantityBox = $(
"#quantity"
).kendoNumericTextBox({
min: 1,
format:
"#.00 units"
,
change:
function
(e){
fromCombo.input.focus();
fromCombo.open();
}
}).data(
"kendoNumericTextBox"
);
<
button
id
=
"moveButton"
class
=
"k-button"
><
img
/>Move</
button
>
<
button
id
=
"viewXML"
><
img
/></
button
>
#moveButton img, #viewXML img
{
content
:
""
;
float
:
left
;
width
:
16px
;
height
:
16px
;
margin
:
5px
5px
0
0
;
background-image
:
url
(
'images/SpritesSmall.png'
);
background-position
:
-70px
center
;
}
$(
"#viewXML"
).kendoDropDownList([{ text:
"Option 1"
, value:
"1"
}, { text:
"Option 2"
, value:
"2"
}]);
$(
"#viewXML"
).data(
"kendoDropDownList"
).text(
"View XML"
)
/* Initialize panel bars */
$(
"#panelbar1"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar2"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar3"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar4"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar5"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar6"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar7"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar8"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar9"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar10"
).kendoPanelBar().data(
"kendoPanelBar"
);
$(
"#panelbar11"
).kendoPanelBar().data(
"kendoPanelBar"
);
/* expand/collapse panel */
$(
".triggerItem"
).click(
function
(e) {
var
target =
this
;
var
panelbar =
'#'
+ target.element.context.id;
var
item = $( panelbar ).select();
if
(item.hasClass(
"k-state-active"
)) {
$( panelBar ).collapse(item);
}
else
{
$( panelBar ).expand(item);
}
});
// Collapse all the sections in the panel
$(
'.p-collapse'
).click(
function
(e) {
var
elementId =
this
.id;
var
target =
'#panelbar'
+ elementId.substring(0, elementId.length - 6) ;
var
panelBar = $( target ), clone = $( target ).clone(
true
);
panelBar.data(
"kendoPanelBar"
).collapse( target +
' k-link'
);
panelBar.replaceWith( clone );
$(target).kendoPanelBar();
});
<style scoped="scoped"> .info { display: block; line-height: 22px; padding: 0 5px 5px 0; color: #36558e; } #shipping { width: 482px; height: 152px; padding: 110px 0 0 30px; background: url('../content/autocomplete/shipping.png') transparent no-repeat 0 0; margin: 30px auto; } .k-autocomplete { width: 250px; vertical-align: middle; } .hint { line-height: 22px; color: #aaa; font-style: italic; font-size: .9em; color: #7496d4; } </style>
<
ul
id
=
"books"
></
ul
>
<
script
id
=
"template"
type
=
"text/x-kendo-template"
>
<
li
class
=
"book"
>
<
h3
>#= title #</
h3
>
by #= author #
</
li
>
</
script
>
<
script
>
$(document).ready(function() {
function onChage() {
$("#books").html(kendo.render(template, this.view()));
}
// create a template using the above definition
var template = kendo.template($("#template").html());
var dataSource = new kendo.data.DataSource({
transport: {
read: "filters.xml"
},
schema: {
// specify the the schema is XML
type: "xml",
data: "/Filters/Filter",
model: {
fields: {
title: "title/text()",
author: "@Id",
url: "info/text()"
}
}
},
change: onChage
});
dataSource.read();
});
</
script
>
<?
xml
version
=
"1.0"
?>
-<
Filters
> -<
Filter
Id
=
"drwho"
> <
Collection
>drwho</
Collection
> <
Title
>Favourite Doctor</
Title
> <
Info
>link_to_popup_info.html</
Info
> <
Image
>drwho.png</
Image
> </
Filter
> -<
Filter
Id
=
"poo"
> <
Collection
>poop</
Collection
> <
Title
>smell that?</
Title
> <
Info
>link_to_popup_info.html</
Info
> <
Image
>poop.png</
Image
> </
Filter
> </
Filters
>