PDA

View Full Version : Unable to display data in a template



howHardCanItBe
31 Jan 2012, 1:40 PM
Hi, I am having some trouble getting data to show in a template. I was unable to find anything in the forums, stackoverflow, or google that was specific enough to debug the issue. When I run the following I receive no errors, warnings or anything. I have verified that the JSON result has data, it just never loads into the store or anywhere else.



Ext.Loader.setConfig({
enabled: true
});


Ext.onReady(function () {
Ext.define('themodel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'string' },
{ name: 'source', type: 'string' },
{ name: 'date', type: 'date' },
{ name: 'title', type: 'string' },
{ name: 'feed', type: 'string' }
]
});
var theStore = Ext.create('Ext.data.Store', {
model: 'themodel',
proxy: {
type: 'ajax',
url: '/Home/Search?query="source:twitter"',
reader: {
type: 'json',
record: 'Result'
}
},
autoload: true,
listeners: {
exception: function (proxy, response, operation) {
console.log(arguments);
}
}
});
var temp = new Ext.XTemplate(
'<tpl for=".">',
'<div>',
'<p>{source}</p>',
'<p>{date}</p>',
'<p>{title}</p>',
'<p>{feed}</p>',
'</div>',
'</tpl>'
);
Ext.create('Ext.Container', {
id: 'main',
layout: 'fit',
renderTo: Ext.getBody(),
items: [
{
html: "this shows up"
},
{
xtype: 'dataview',
store: theStore,
tpl: temp
}
]
});
});

mitchellsimoens
1 Feb 2012, 6:50 AM
What does the JSON look like?