store.load method을 사용해 보셨습니까?
store.load({
callback: function(records, operation, success) {
console.log(records);
}
});
UPDATE는this 엽차의 예를 바탕으로
, 난 당신에 extjs에게 6.5.2 고전을 사용하는 예를 만들었습니다. 현대 virtualstore
이 bufferedstore
대신 사용되고 있기 때문에 고전적인 툴킷을 사용했습니다. 관심의
Ext.define('ForumThread', {
extend: 'Ext.data.Model',
fields: [{
name: 'title',
mapping: 'topic_title'
}, {
name: 'forumtitle',
mapping: 'forum_title'
}, {
name: 'forumid',
type: 'int'
}, {
name: 'username',
mapping: 'author'
}, {
name: 'replycount',
mapping: 'reply_count',
type: 'int'
}, {
name: 'lastpost',
mapping: 'post_time',
type: 'date',
dateFormat: 'timestamp'
},
'lastposter', 'excerpt', 'topic_id'
],
idProperty: 'post_id'
});
var store = Ext.create('Ext.data.BufferedStore', {
id: 'store',
model: 'ForumThread',
// The topics-remote.php script appears to be hardcoded to use 50, and ignores this parameter, so we
// are forced to use 50 here instead of a possibly more efficient value.
pageSize: 50,
// This web service seems slow, so keep lots of data in the pipeline ahead!
leadingBufferZone: 1000,
proxy: {
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
type: 'jsonp',
url: 'https://www.sencha.com/forum/topics-remote.php',
reader: {
rootProperty: 'topics',
totalProperty: 'totalCount'
},
// sends single sort as multi parameter
simpleSortMode: true,
// Parameter name to send filtering information in
filterParam: 'query',
},
remoteFilter: true,
autoLoad: false
});
function onSearchParamApplied() {
var searchParam = grid.down('#txtSearchParam').getValue();
var store = grid.getStore();
if (!store)
return;
store.getProxy().extraParams['query'] = searchParam;
store.reload({
callback: function (records, operation, success) {
grid.down('#status').setValue(store.getTotalCount());
}
});
}
function onStoreLoadClick() {
var store = grid.getStore();
if (!store)
return;
store.load({
callback: function (records, operation, success) {
grid.down('#status').setValue(store.getTotalCount());
}
});
}
var grid = Ext.create('Ext.grid.Panel', {
width: 700,
height: 470,
padding: 10,
collapsible: true,
title: 'ExtJS.com - Browse Forums',
store: store,
loadMask: true,
dockedItems: [{
dock: 'top',
xtype: 'toolbar',
items: [{
xtype: 'textfield',
itemId: 'txtSearchParam',
width: 400,
fieldLabel: 'Search',
labelWidth: 50,
}, {
xtype: 'button',
iconCls: 'x-fa fa-search',
tooltip: 'Reload buffered store with the new param',
handler: onSearchParamApplied
}, {
xtype: 'button',
text: 'loadGrid',
handler: onStoreLoadClick
},'->', {
xtype: 'displayfield',
itemId: 'status',
fieldLabel: 'Count ',
value: '0' //initial value
}]
}],
selModel: {
pruneRemoved: false
},
multiSelect: true,
viewConfig: {
trackOver: false,
emptyText: '<h1 style="margin:20px">No matching results</h1>'
},
// grid columns
columns:[{
xtype: 'rownumberer',
width: 50,
sortable: false
},{
tdCls: 'x-grid-cell-topic',
text: "Topic",
dataIndex: 'title',
flex: 1,
//renderer: renderTopic,
sortable: false
},{
text: "Author",
dataIndex: 'username',
width: 100,
hidden: true,
sortable: false
},{
text: "Replies",
dataIndex: 'replycount',
align: 'center',
width: 70,
sortable: false
},{
id: 'last',
text: "Last Post",
dataIndex: 'lastpost',
width: 130,
renderer: Ext.util.Format.dateRenderer('n/j/Y g:i A'),
sortable: false
}],
renderTo: Ext.getBody()
});
포인트 :
- 클릭 "loadGrid"button
가 레코드를로드 여기
는 코드입니다.
- "검색"textfield
에 텍스트를 추가하고 입력 한 텍스트로 제공되는 쿼리를 기반으로 그리드를 새로 고치려면 검색 버튼을 클릭하십시오.
sencha fiddle 안에 코드를 추가하고 (오른쪽 상단 selectfield에서 고전 테마를 선택) 실행할 수도 있습니다.
내가 도움이 되었기를 바랍니다.
그렇지 않습니다. 원격 소스에서 가져온 대용량 데이터 세트입니다. –
A [BufferedStore'] (https://docs.sencha.com/extjs/6.5.2/classic/Ext.data.BufferedStore.html)에서'loadData()'를 사용할 필요가 없다고 생각합니다. 왜냐하면 A 'BufferedStore'는 초대형 서버 측 데이터 세트에 상응하는 드문 드문 채워진 페이지 맵을 유지합니다. 그것은'서버 측 'API와 직접 연결된다는 것을 의미합니다. 'loadData()'를 사용하려면이''store' (https://docs.sencha.com/extjs/6.5.2/classic/Ext.data.Store.html)을 사용해야합니다. –