View Full Version : read XML

19 Oct 2011, 12:41 AM
i'm trying to read an XML file, get the content and display this in a panel.
For that, i have chosen DataView ....
But nothing is displayed ....

I Call my DataView since a panel with:
items: [WPApp.views.WeatherPanelContainer],


WPApp.views.WeatherPanelContainer = new Ext.DataView({
store: WPApp.stores.WeatherPanelContainerStore,
itemSelector: "div.item",
tpl: '{lsup}',
fullscreen: true

And the store and model:

Ext.regModel('WPApp.models.WeatherPanelContainerModel', {
fields: [
{name: 'lsup', type: 'string'},
{name: 'tmp', type: 'string'},
{name: 'flik', type: 'string'},
{name: 't', type: 'string'},
{name: 'icon', type: 'string'}

WPApp.stores.WeatherPanelContainerStore = new Ext.data.Store({
model: 'WPApp.models.WeatherPanelContainerModel',
proxy: {
type: 'ajax',
url: 'weather.xml',
reader: {
type: 'xml',
root: 'weather',
record: 'cc'
autoLoad: true

I don't understand what is itemSelector: "div.item". But i know i need it cause else, nothing work ....

Can you help me please?

19 Oct 2011, 12:47 AM
Try changing tpl to itemTpl?.

19 Oct 2011, 12:50 AM
thanks to answer.

I did that, but all the application don't work when i do itemTpl or if i put out itemSelector ...

19 Oct 2011, 12:53 AM
And my XML is:

<weather ver="2.0">
<loc id="FRXX5514">
<dnam>Vals-les-Bains, France</dnam>
<tm>9:47 AM</tm>
<sunr>8:02 AM</sunr>
<suns>6:52 PM</suns>
<lsup>10/19/11 9:30 AM Local Time</lsup>
<obst>Saint-Etienne, FRANCE</obst>
<t>Light Rain</t>

19 Oct 2011, 12:57 AM
Omg, i needed to write in my view:

tpl: new Ext.XTemplate([
'<tpl for=".">',
'<div class="car">{lsup}</div>',