I've got the following code that works well for initial load. Once I execute .query I receive "Uncaught TypeError: Cannot read property '0' of undefined". Kendo UI Mobile v2012.1.322
Am I using .query improperly?
Datasource/bind/sample data:
Am I using .query improperly?
Datasource/bind/sample data:
var
ds =
new
kendo.data.DataSource({
transport: {
read: {
url:
"http://localhost:3000/api/anagram"
,
dataType:
"jsonp"
,
data: {
format:
'html'
,
rack:
'---'
}
}
},
group:
'length'
,
pageSize: $(
'#pageSize'
).val(),
page: $(
'#page'
).val(),
sort: {field:
'word'
, dir:
'asc'
},
schema: {
data:
'words'
,
total:
'count'
,
model: {
fields: {
length: {
type:
'number'
},
word: {
type:
'string'
},
wordFormat: {
type:
'string'
}
}
}
}
//serverFiltering: true,
//filter: { field: 'rack', operator: 'eq', value: 'ab-' },
//serverSorting: false,
});
function
resultsBind() {
console.log(
'Fetching...'
);
ds.fetch(
function
(){
console.log(
'Actually fetched'
);
console.log(ds.total());
console.log(ds.totalPages());
$(
"#grouped-listview"
).kendoMobileListView({
dataSource: ds,
template:
"#= wordFormat #"
,
headerTemplate:
"${value} Letters"
});
$(
'.prefix'
).html(ds.total() +
' words found'
);
});
$(
'#apply'
).click(
function
(){
var
p = $(
'#page'
).val();
var
ps = $(
'#pageSize'
).val();
ds.query({ page: p, pageSize: ps });
});
}
{
"words"
:[{
"length"
:3,
"word"
:
"azo"
,
"wordFormat"
:
"<em>a</em>zo"
},{
"length"
:2,
"word"
:
"bo"
,
"wordFormat"
:
"<em>b</em>o"
},{
"length"
:3,
"word"
:
"coz"
,
"wordFormat"
:
"<em>c</em>oz"
},{
"length"
:2,
"word"
:
"do"
,
"wordFormat"
:
"<em>d</em>o"
},{
"length"
:2,
"word"
:
"go"
,
"wordFormat"
:
"<em>g</em>o"
},{
"length"
:2,
"word"
:
"ho"
,
"wordFormat"
:
"<em>h</em>o"
},{
"length"
:2,
"word"
:
"jo"
,
"wordFormat"
:
"<em>j</em>o"
},{
"length"
:2,
"word"
:
"lo"
,
"wordFormat"
:
"<em>l</em>o"
},{
"length"
:2,
"word"
:
"mo"
,
"wordFormat"
:
"<em>m</em>o"
},{
"length"
:2,
"word"
:
"no"
,
"wordFormat"
:
"<em>n</em>o"
},{
"length"
:2,
"word"
:
"od"
,
"wordFormat"
:
"o<em>d</em>"
},{
"length"
:2,
"word"
:
"oe"
,
"wordFormat"
:
"o<em>e</em>"
},{
"length"
:2,
"word"
:
"of"
,
"wordFormat"
:
"o<em>f</em>"
},{
"length"
:2,
"word"
:
"oh"
,
"wordFormat"
:
"o<em>h</em>"
},{
"length"
:2,
"word"
:
"oi"
,
"wordFormat"
:
"o<em>i</em>"
},{
"length"
:2,
"word"
:
"om"
,
"wordFormat"
:
"o<em>m</em>"
},{
"length"
:2,
"word"
:
"on"
,
"wordFormat"
:
"o<em>n</em>"
},{
"length"
:2,
"word"
:
"op"
,
"wordFormat"
:
"o<em>p</em>"
},{
"length"
:2,
"word"
:
"or"
,
"wordFormat"
:
"o<em>r</em>"
},{
"length"
:2,
"word"
:
"os"
,
"wordFormat"
:
"o<em>s</em>"
},{
"length"
:2,
"word"
:
"ow"
,
"wordFormat"
:
"o<em>w</em>"
},{
"length"
:2,
"word"
:
"ox"
,
"wordFormat"
:
"o<em>x</em>"
},{
"length"
:2,
"word"
:
"oy"
,
"wordFormat"
:
"o<em>y</em>"
},{
"length"
:2,
"word"
:
"so"
,
"wordFormat"
:
"<em>s</em>o"
},{
"length"
:2,
"word"
:
"to"
,
"wordFormat"
:
"<em>t</em>o"
},{
"length"
:2,
"word"
:
"wo"
,
"wordFormat"
:
"<em>w</em>o"
},{
"length"
:2,
"word"
:
"yo"
,
"wordFormat"
:
"<em>y</em>o"
},{
"length"
:2,
"word"
:
"za"
,
"wordFormat"
:
"z<em>a</em>"
},{
"length"
:3,
"word"
:
"zoa"
,
"wordFormat"
:
"zo<em>a</em>"
},{
"length"
:3,
"word"
:
"zoo"
,
"wordFormat"
:
"zo<em>o</em>"
}],
"count"
:30,
"input"
:
"zo?"
}