代码在这里:
Ext.define('Book', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int'},
{name: 'title', type: 'string'},
{name: 'pages', type: 'int'},
{name: 'numChapters', type: 'int'}
]
});
var ajaxProxy = Ext.create('Ext.data.proxy.Ajax', {
url: 'books.json',
model: 'Book'
});
var operation = Ext.create('Ext.data.Operation', {
action: 'read',
start: 0,
limit: 5
});
operation.read();
book.json 包含 6 行,当我尝试下面的代码时,我得到 6 行,而我预计它的负载为 5 行。
ajaxProxy.read(operation, function ()
{
console.log(operation.response.responseText);
});