0
即時通訊使用AJAX請求以JSON格式從服務器獲取值。 但是當我嘗試在Ext.List中顯示此值時,只顯示1個值而不是全部。Ext.List僅顯示1個值,而不是全部
Ext.setup({
onReady: function() {
Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});
var posts;
var count;
var name = 'sdf';
Ext.Ajax.request({
url: 'a.php/pool/listPools',
method: 'post',
type:'json',
success: function(response){
posts = Ext.decode(response.responseText);
alert(response.responseText);
count = posts.count;
for (var i = 0; i < count; i++) {
name = posts.data[i].name;
alert(name);
var btnContact = new Ext.TabPanel({
fullscreen: true,
items: [ new Ext.List({
itemTpl:'',
title: 'My Tab',
tpl: '<tpl for="."><div class="contact"><strong>{firstName}</strong> {lastName}</div></tpl>',
itemSelector: 'div.contact',
singleSelect: true,
grouped: true,
indexBar: false,
store: new Ext.data.JsonStore({
model: 'Contact',
sorters: 'firstName',
getGroupString: function (record) {
return record.get('firstName');
},
data: [
{
firstName: name,
lastName: ''
}
]
})
}),
//{ title: 'Tab 2' }
]
});
}}
});
}
});
Sooo我的問題是,我怎樣才能顯示所有檢索到的數據?而不是1?