我是 Sencha touch 的新手。请在下面查看我的代码。
模型.js
Ext.define('bluebutton.model.BlueButton.MemberList', {
extend: 'Ext.data.Model',
config: {
idProperty: 'memberlistModel',
fields: [
{ name :'memberId'},
{ name: 'fullName' },
{ name: 'phone' },
{ name: 'age' },
{ name: 'point' },
{ name :'address'},
{ name: 'emailAddress' },
{ name: 'lastVisited' },
{ name: 'consumer_bbID' },
{ name: 'merchant_bbID' },
{ name: 'sessionId' },
{ name: 'deviceId' },
{ name: 'currentPoint' },
],
proxy: {
type: 'rest',
// url: 'http://192.168.251.131:8080/WebCommon/rest/BBWebService/getMembersList',
url: 'http://mixsoloffice.no-ip.biz:82/WebCommon/rest/BBWebService/getMembersList',
// url: 'http://192.168.251.182:8080/WebCommon/rest/BBWebService/getMembersList',
reader: 'json',
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",
// add as many as you need
},
// timeout:1000,
// listeners: {
// exception: function(proxy, response, operation) {
// alert("Connection Problem");
// Ext.Viewport.setMasked(false); // hide the load screen
//
// }
// },
reader: {
type: 'json',
rootProperty: 'membersList'
},
writer: {
type: 'json',
},
}
}
});
Store.js
Ext.define('bluebutton.store.BlueButton.MemberList', {
extend: 'Ext.data.Store',
requires: [
'bluebutton.model.BlueButton.MemberList'
],
config: {
grouper: {
groupFn: function (record) {
return record.get('fullName')[0];
}
},
model :'bluebutton.model.BlueButton.MemberList',
storeId :'memberStore',
autoLoad: true,
clearOnPageLoad: false, // This is true by default
pageSize: 10,
}
});
List.js
Ext.define('bluebutton.view.BlueButton.MemberList', {
extend: 'Ext.List',
xtype: 'memberlistcard',
requires: [
'Ext.field.Select',
'Ext.field.Search',
'Ext.plugin.ListPaging',
'Ext.plugin.PullRefresh',
],
config: {
styleHtmlContent: true,
scrollable: 'vertical',
singleSelect: true,
grouped: true,
variableHeights : false,
store : { xclass : 'bluebutton.store.BlueButton.MemberList'},
itemHeight :100,
loadingText : 'loading',
id :'memberlist',
masked: {
xtype: 'loadmask',
message: 'loading...'
}, // masked
plugins: [
// { xclass: 'Ext.plugin.PullRefresh',
// pullRefreshText: 'Pull down for more updates!',
// refreshFn:function(loaded, arguments){
//
// var store = Ext.getCmp('transactionlist').getStore();
// alert(store.getValue());
//// var transactionlist = Ext.getCmp('transactionlist');
////
//// transactionlist.setStore(store);
// }
//
//
// },
// {
// xclass: 'Ext.plugin.ListPaging',
//// autoPaging: true,
//
//
//
// },
],
id :'memberlist',
emptyText: '<p class="no-search-results">No member 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>{consumer_bbID}</h3>',
' <h3>Name: {fullName}</h3>',
' <h3>Point Avalaible : {currentPoint} , Last Visited : {lastVisited}</h3>',
' </div>',
'</td>',
'</tr>',
'</table>',
'</div>'
),
},
});
我需要在列表渲染之前分配额外的参数值。我怎样才能做到这一点?