I've reproduced a problem I'm seeing in my own application by modifying the Data Source > Binding to XML example to use a grid for rendering rather than a template, as shown in the code below. Except for specifying an original sort order, the data source is unchanged. I've configured the grid to allow grouping and sorting. However, whenever I attempt to either group or sort, I get
Error: Unable to get value of the property 'book': object is null or undefined
The debugger call stack indicates that the error is occurring in an "evaluate" method in kendo.data.xml.min.js. (I have the trial version, so can't inspect the source code further.)
Additionally, my original sort order is not being respected; the grid loads unsorted.
Are these bugs mine or the framework's?
<div id="grid"></div><script> $(document).ready(function() { var element = $("#grid").kendoGrid({ dataSource: { transport: { read: "books.xml" }, schema: { type: "xml", data: "/books/book", model: { fields: { title: "title/text()", author: "author/text()", url: "url/text()", cover: "@cover" } }, sort: { field: "title", dir: "asc" } } }, columns: [ "title", "author", "url" ], groupable: true, sortable: { mode: "single", allowUnsort: false } }); });</script>Operator 'eq' incompatible with operand types 'System.Int32' and 'System.String' at position 5.text/x-kendo-templ
ortext/x-kendo-template ?
You find boths.
Thanks
Eric
(Kendo UI v2012.3.111)Kendo UI v2012.3.111
$('#contacts').kendoGrid({ scrollable: true, dataSource:contacts, sortable: true, //navigatable:true, autobind:true, pageable: true, selectable: "single", toolbar: ["create", "save", "cancel"], editable: true, columns:[ { field:"ContactRoleType", title:"Contact Type", editor: ContactTypeEditor }, { field:"FirstName", title:"First Name" }, { field:"LastName", title:"Last Name" }, { field:"EmailAddress", title:"Email Address" }, { field:"CountryName", title:"Country" }, { field:"PhoneNumber", title:"Phone" }, { field:"FaxNumber", title:"Fax" }, { field:"Comments", title:"Comments" }, { command:"destroy", title:"" }] }); }); function ContactTypeEditor(container, options) { $('<input name="' + options.field + '"/>') .appendTo(container) .kendoDropDownList({ dataSource: { transport: { read: { url: "@Url.Action("ContactTypes","Contacts",new {Area="CRM"})", dataType: "json", contentType: "application/json; charset=utf-8", } } }, dataTextField:"Text", dataValueField:"Text", autoBind: true }); }
Any Ideas why the following code should produce an error?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!--In the header of your page, paste the following for Kendo styles-->
<link href="styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="styles/kendo.kendo.min.css" rel="stylesheet" type="text/css" />
<!--Then paste the following for Kendo scripts-->
<script src="scripts/jquery.min.js" type="text/javascript"></script>
<script src="scripts/kendo.all.min.js" type="text/javascript"></script>
<title>Binding to remote data</title>
</head>
<body>
<div id="example" class="k-content">
<div id="grid"></div>
<script type="text/javascript">
var dateRegExp = /^\/Date\((.*?)\)\/$/;
function toDate(value) {
var date = dateRegExp.exec(value);
return new Date(parseInt(date[1]));
}
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://localhost:64526/WcfLeaguesDataService.svc/tbl_Umpires"
},
schema: {
model: {
fields: {
Id: { type: "number" },
Firstname: { type: "string" },
LastName: { type: "string" },
EmailAdd: { type: "string" }
}
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 250,
filterable: true,
sortable: true,
pageable: true,
columns: [{
field: "Id",
filterable: false
},
"Firstname",
"LastName",
"EmailAdd"
]
});
});
</script>
</div>
</body>
</html>
The Error is:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code></code><message xml:lang="en-GB">The query parameter '$format' begins with a system-reserved '$' characterbut is not recognized.</message></error>
As it is just an edit of the Example code. (The WCF string pasted into the browser, seems to work fine)