我有一个网格,当我将数据加载到网格时,我用pageSize: 10
分页,我想从该网格获取数据存储以检查其他网格中的冗余数据,但我只得到10个数据,因为我已经设置了pageSize 10,实际上数据超过了10个。
如何让网格中的所有数据都已分页?
我已经使用代理类型" pagingmemory"但没有工作 这是我的商店:
var store = Ext.create('Ext.data.Store', {
//extend: 'Ext.data.Store',
model: settings.namespace + 'model.FormRequestDetailModel',
remoteSort: true,
remoteFilter: true,
autoLoad: false,
pageSize: 10,
//proxy: {
// type: 'pagingmemory'
//},
sorters: [{
property: 'FormRequestNo',
direction: 'ASC'
}]
});
var filters = [];
var filter = {
property: 'FormRequestID',
value: data.ID
};
filters.push(filter);
store.filters.clear();
if (filters.length == 0) {
store.load();
} else {
store.filter(filters);
}
这是模型:
//-----------Structure for PurchaseOrder -----------------------//
Ext.define(settings.namespace + 'model.FormRequestDetailModel', {
extend: 'Ext.data.Model',
fields: [{
name: 'ID',
mapping: 'ID'
}, {
name: 'FormRequestID',
mapping: 'FormRequestID'
}, {
name: 'MaterialStockID',
mapping: 'MaterialStockID'
}, {
name: 'MaterialID',
mapping: 'MaterialID'
}, {
name: 'Item',
mapping: 'Item'
}, {
name: 'MaterialNo',
mapping: 'MaterialNo'
}, {
name: 'MaterialDescription',
mapping: 'MaterialDescription'
}, {
name: 'Quantity',
mapping: 'Quantity'
}, {
name: 'UOMID',
mapping: 'UOMID'
}, {
name: 'UOMDescription',
mapping: 'UOMDescription'
}, {
name: 'GLAccountID',
mapping: 'GLAccountID'
}, {
name: 'GLAccountNo',
mapping: 'GLAccountNo'
}, {
name: 'GLAccountDescription',
mapping: 'GLAccountDescription'
}, {
name: 'InternalAgreement',
mapping: 'InternalAgreement'
}, {
name: 'FundReservationNo',
mapping: 'FundReservationNo'
}, {
name: 'AssetNo',
mapping: 'AssetNo'
}, {
name: 'DeliveryDate',
mapping: 'DeliveryDate'
}, {
name: 'Background',
mapping: 'Background'
}, {
name: 'Purpose',
mapping: 'Purpose'
}, {
name: 'UrgencyID',
mapping: 'UrgencyID'
}, {
name: 'UrgencyDescription',
mapping: 'UrgencyDescription'
}, {
name: 'LineStopPotentialID',
mapping: 'LineStopPotentialID'
}, {
name: 'LineStopPotentialDescription',
mapping: 'LineStopPotentialDescription'
}, {
name: 'BackupListID',
mapping: 'BackupListID'
}, {
name: 'BackupListDescription',
mapping: 'BackupListDescription'
}, {
name: 'ReplaceID',
mapping: 'ReplaceID'
}, {
name: 'ReplaceDescription',
mapping: 'ReplaceDescription'
}, {
name: 'FormRequestStatusID',
mapping: 'FormRequestStatusID'
}, {
name: 'IsDrop',
mapping: 'IsDrop'
}, {
name: 'RejectionReasonID',
mapping: 'RejectionReasonID'
}, {
name: 'RejectionReason',
mapping: 'RejectionReason'
}, {
name: 'CreatedTime',
mapping: 'CreatedTime'
}, {
name: 'CreatedBy',
mapping: 'CreatedBy'
}, {
name: 'LastModifiedTime',
mapping: 'LastModifiedTime'
}, {
name: 'LastModifiedBy',
mapping: 'LastModifiedBy'
}, {
name: 'RowStatus',
mapping: 'RowStatus'
}, {
name: 'RejectionReason',
mapping: 'RejectionReason'
}, {
name: 'Approved',
type: 'boolean',
defaultValue: false
}],
idProperty: 'ID',
proxy: {
type: 'ajax',
url: settings.apiUrl + 'FormRequest/GetDetail',
actionMethods: {
read: 'POST'
},
reader: {
type: 'json',
root: 'data.rows',
totalProperty: 'totalCount'
}
},
sorters: [{
property: 'ID',
direction: 'DESC'
}]
});
答案 0 :(得分:1)
网格视图绑定到商店。这意味着,如果您的网格是可见的,并且您将不同的数据集加载到商店中,则视图将立即反映更改。
这就是我如何解决这个问题:使用相同的数据源创建第二个商店,但没有分页。然后,在加载未分页的数据集之前,将网格上的过滤器应用于第二个商店。
关于模型的注意事项:如果mapping
与name
相同,则无需声明type
。而是声明select *
from reviews
where app_id = '2332223'
order by review_updated_at
offset 200
limit 100;
,这对于格式化或网格是否可编辑非常重要。
答案 1 :(得分:0)
您可以创建一个循环来完成更改页面,直到检索到所有值。
我认为这可以解决您的问题。 https://stackoverflow.com/a/33785646/5577577