notinotinoti
11 Jul 2010, 10:56 PM
Hello~
I want to display each item in each line.
But this code`s result display all items in one line.
I can not solve this problem.
Please help me.. (Sorry about my pool English level.. )
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
Ext.regModel('testData', {
fields: ['title', 'post', 'date', 'link']
});
var listItems = [];
var results = [];
this.fund = new Ext.Component({
tpl: [
'<div class="json-data">',
'<tpl for=".">',
'<div class="data">',
'<div class="title">{title}</div>',
'<div class="post">{post}</div>',
'<div class="date">{date}</div>',
'<div class="link">{link}</div>',
'</div>',
'</tpl>',
'</div>'
]
});
listItems.push(this.fund);
Ext.util.JSONP.request({
url: 'http://www.calculatewhat.com/data.json',
callbackKey: 'callback',
callback: function(data) {
try{
listItems[0].update(data);
}
catch(error){
alert(error);
}
}
});
var panel = new Ext.List({
fullscreen: true,
animation: 'slide',
itemSelector: 'div.json-data',
items: [listItems[0]]
});
}
});
ex)
Wrong result (present)
------------
Title 1
Post Text 1
Date 1
URL 1
Title 2
Post Text 2
Date 2
URL 2
------------
Correct result (future)
------------
Title 1
------------
Post Text 1
------------
Date 1
------------
URL 1
------------
Title 2
------------
Post Text 2
------------
Date 2
------------
URL 2
------------
I want to display each item in each line.
But this code`s result display all items in one line.
I can not solve this problem.
Please help me.. (Sorry about my pool English level.. )
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
Ext.regModel('testData', {
fields: ['title', 'post', 'date', 'link']
});
var listItems = [];
var results = [];
this.fund = new Ext.Component({
tpl: [
'<div class="json-data">',
'<tpl for=".">',
'<div class="data">',
'<div class="title">{title}</div>',
'<div class="post">{post}</div>',
'<div class="date">{date}</div>',
'<div class="link">{link}</div>',
'</div>',
'</tpl>',
'</div>'
]
});
listItems.push(this.fund);
Ext.util.JSONP.request({
url: 'http://www.calculatewhat.com/data.json',
callbackKey: 'callback',
callback: function(data) {
try{
listItems[0].update(data);
}
catch(error){
alert(error);
}
}
});
var panel = new Ext.List({
fullscreen: true,
animation: 'slide',
itemSelector: 'div.json-data',
items: [listItems[0]]
});
}
});
ex)
Wrong result (present)
------------
Title 1
Post Text 1
Date 1
URL 1
Title 2
Post Text 2
Date 2
URL 2
------------
Correct result (future)
------------
Title 1
------------
Post Text 1
------------
Date 1
------------
URL 1
------------
Title 2
------------
Post Text 2
------------
Date 2
------------
URL 2
------------