我需要通过从下拉列表中选择值来动态填充列表。
例如,当我选择活动记录时,我的列表将填充活动记录。如果我选择删除记录,那么列表将填充已删除的记录。
请在下面查看我的代码
模型.js
Ext.define('bluebutton.model.BlueButton.TransactionList', {
extend: 'Ext.data.Model',
config: {
idProperty:'transactionId',
// id:'transactionlistmodel',
fields: [
{ name: "transactionId" ,type:"string" },
{ name: "merchant_bbID" ,type:"string" },
{ name: "sessionId" ,type:"string"},
{ name: "deviceId" ,type:"string"},
{ name: "createDateTime" ,type:"string"},
{ name: "fullName" ,type:"string"},
{ name: "action" ,type:"string"},
{ name: "updatedPoint" ,type:"string"},
{ name: "createDate" ,type:"string"},
{ name: "status",type:"string" },
],
proxy: {
type: 'rest',
url: 'http://localhost:8080/WebCommon/rest/BBWebService/getPointTransactionList',
// url: 'http://mixsoloffice.no-ip.biz:82/WebCommon/rest/BBWebService/getPointTransactionList',
actionMethods: {
create: 'POST',
read: 'GET',
update: 'PUT',
destroy: 'DELETE'
},
// noCache: false, // get rid of the '_dc' url parameter
extraParams: {
sessionId: "1",
deviceId: "1",
merchant_bbID: "merchant1",
filterType :"0"
// add as many as you need
},
reader: {
type: 'json',
rootProperty: 'pointTransHistoryList',
totalProperty: 'totalRecord',
successProperty: 'success',
},
writer: {
type: 'json',
},
}
}
});
Store.js
Ext.define('bluebutton.store.BlueButton.TransactionList', {
extend: 'Ext.data.Store',
requires: [
'bluebutton.model.BlueButton.TransactionList'
],
config: {
grouper: {
groupFn: function (record) {
return record.get('createDateTime');
}
},
model: 'bluebutton.model.BlueButton.TransactionList',
pageSize: 5,
autoLoad: true,
storeId: 'transactionliststore',
sorters: 'createDateTime',
groupDir: 'DESC',
autoSync: true,
clearOnPageLoad: false,
}
});
视图.js
Ext.define('bluebutton.view.BlueButton.TransactionList', {
extend: 'Ext.List',
xtype: 'transactionlistcard',
requires: [
'Ext.field.Select',
'Ext.field.Search',
'Ext.plugin.ListPaging',
'Ext.plugin.PullRefresh',
'bluebutton.store.BlueButton.TransactionList',
],
config: {
styleHtmlContent: true,
scrollable: {
direction: 'vertical',
directionLock: true
},
singleSelect: true,
grouped: true,
variableHeights : false,
store : { xclass : 'bluebutton.store.BlueButton.TransactionList'},
itemHeight :100,
loadingText : 'loading',
id :'transactionlist',
masked: {
xtype: 'loadmask',
message: 'loading...'
}, // masked
plugins: [
{
xclass: 'Ext.plugin.PullRefresh',
pullRefreshText: 'Pull down for more new Tweets!',
// refreshFn: function(callback, plugin) {
// var store = plugin.list.getStore();
// store.load(function(records, operation, success) {
// callback.call(plugin);
// console.log( records );
// });
// }
},
{
xclass: 'Ext.plugin.ListPaging',
//
}
],
emptyText: '<p class="no-search-results">No Transaction record found matching that search</p>',
itemTpl: Ext.create(
'Ext.XTemplate',
'<div class="tweet-wrapper">',
'<table>',
'<tr>',
'<td rowspan="2" width="28%" >',
// '<div style="padding-left: 30px;">',
// ' <img src="{imgUrl}" width="140" height="130" /></div>',
'</td>',
'<td>',
' <div class="tweet">',
' <h3>Transaction ID: {transactionId} , Point: {updatedPoint} pts , Action: {action}</h3>',
' <h3>Status: {status}, Transaction By: {fullName} , Transaction Date: {createDateTime}</h3>',
' </div>',
'</td>',
'</tr>',
'</table>',
'</div>'
),
listeners: {
updatedata: function (me, newData, eOpts ) {
alert(newData)
}
},
},
});
控制器.js
onTransactionStatusChange: function (selectField, value) {
var sto = Ext.getCmp('transactionlist').getStore();
sto.removeAll();
sto.sync()
var thelist = this.getTransactionlist();
thelist.setStore(sto);
sto.load({
params:{
filterType : value,
sessionId :'1',
merchant_bbID:'merchant1',
page:'1',
start:'0',
limit:'5'
}
});
},
现在我面临一个问题。
假设在活动 列表中,当前页面是第 2 页,它显示不再加载记录 。但是当我更改为删除列表时,该列表也显示no more record loaded。从下拉列表中选择值时如何重置分页