PDA

View Full Version : JSON / Ajax and Appcelerator Titanium



qfler
6 Jun 2011, 6:18 AM
Hi,
in my project i have several json/ajax requests like this:

.json file:


{
"data":[
{"imgurl":"img/products/dummy_010.jpg","imgtxt":"indica","linkto":"abc"},
{"imgurl":"img/products/dummy_008.jpg","imgtxt":"waganor","linkto":"cde"},
{"imgurl":"img/products/dummy_010.jpg","imgtxt":"waganor","linkto":"cde"},
{"imgurl":"img/products/dummy_010.jpg","imgtxt":"xylo","linkto":"fgh"}
]
}

application.js file:


var product_navigation = new Ext.DataView({
scroll: "horizontal",
cls: "hscrollerpane_prodnav",
store: new Ext.data.Store({
model: 'overview_list',
proxy: {
type: 'ajax',
url : 'lib/datamanagement/product.json',
reader: {
type: 'json',
root: 'data'
}
},
autoLoad : true
}),
tpl: new Ext.XTemplate(
'<div style=\"width:800px;\">',
'<tpl for=".">',
'<div class=\"img_hscroller\">',
'<img src="{imgurl}" />',
'</div>',
'</tpl>',
'</div>'
),
itemSelector: "div.img_hscroller"

});

This works fine so far. Now, I need this to use with appcelerator titanium to create a native iOS app. But with titanium you can't use ajax. I found this http://www.sencha.com/forum/showthread.php?130114-Sencha-Touch-works-fine-with-Appcelerator-Titanium& to get it work with JSONDATA instead of AJAX, but I didn't get it work.

What can I use instead of an ajax request or how can I use the JSONData instead?

Thanks!