or
var
ds =
new
kendo.data.DataSource({
transport: {
read: {
url:
"http://localhost:3000/api/anagram"
,
dataType:
"jsonp"
,
data: {
format:
'html'
}
},
parameterMap:
function
(options) {
if
(options.filter && options.filter.filters.length > 0)
return
{
rack: options.filter.filters[0].value.replace(/\?/g,
'-'
),
format:
'html'
,
limit: options.pageSize,
page: options.page
};
return
options;
}
},
group:
'length'
,
pageSize: 10,
page: 1,
sort: {field:
'w'
, dir:
'asc'
},
filter: { field:
'rack'
, operator:
'eq'
, value:
'z'
},
serverFiltering:
true
,
serverPaging:
true
,
serverGrouping:
true
,
serverSorting:
true
,
error:
function
(e){
alert(e);
console.log(e);
},
change:
function
(e) {
console.log(
'Data changed: '
+
this
.total());
},
schema: {
groups:
'groups'
,
total:
'count'
,
model: {
fields: {
length: {
type:
'number'
},
w: {
type:
'string'
},
f: {
type:
'string'
}
}
}
}
});
Number is not null{
Number is null{
"id"
:
"0422842A222780"
,
"number"
:
"0422842A222780"
}
{
"id"
:
"0422842A222780"
}
As a result I see empty grid. When I remove this field from displaying all works fine Is there any solution?model:{
id:
"id"
,
fields:{
id:{type:
"string"
, editable:
false
},
number:{type:
"string"
, editable:
false
, nullable:
true
},
}
}
SCRIPT5007: Unable to get value of the property 'length': object is null or undefined
kendo.custom.min.js, line 12 character 1304
kendo.bind($(
"#content"
), viewModel);
var cityDataSource = [{ CityID: 1, CityName: 'Delhi' }, { CityID: 2, CityName: 'Noida'}]
var viewModel = kendo.observable({
gridSource: [
{ FirstName: "Shiva", LastName: "Wahi", CityID: 2, Title: "Module Lead", BirthDate: "10/29/1984", Age: 27 },
{ FirstName: "Priya", LastName: "Srivastava", CityID: 1, Title: "Tech Lead", BirthDate: "08/19/1982", Age: 30 }
]
});
$(document).ready(function () {
var dataSource = new kendo.data.DataSource({
pageSize: 30,
data: viewModel.gridSource,
autoSync: true,
schema: {
model: {
fields: {
FirstName: { type: "string" },
LastName: { type: "string" },
CityName: "CityName",
Title: { type: "string" },
BirthDate: { type: "date" },
Age: { type: "number" }
}
}
}
});
<
div
id
=
"grid"
/>
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
editable: true,
height: 260,
toolbar: ["create"],
columns: [
{
field: "FirstName",
title: "First Name",
width: 100
},
{
field: "LastName",
title: "Last Name",
width: 100
},
{
field: "CityName",
title: "City",
width: 100,
editor: cityDropDownEditor
},
{
field: "Title",
width: 75
},
{
field: "BirthDate",
title: "Birth Date",
width: 75,
template: '#= kendo.toString(BirthDate,"MM/dd/yyyy") #'
},
{
field: "Age",
width: 50
}
]
});
});
function cityDropDownEditor(container, options) {
$('<
input
data-text-field
=
"CityName"
data-value-field
=
"CityName"
data-bind
=
"value:' + options.field + '"
/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataSource: cityDataSource
});
}