PDA

View Full Version : Groupingstore not loading data from URL but with actual file it's OK ?



drunkmoose
15 Sep 2010, 10:01 AM
Hi there,

I'm having this problem where my Groupingstore always has 0 records.

Things I've checked:

1 - Server response for main_xml.asp: Yup, Firebug shows some XML in there and if I browse it, I'll see proper XML too
2 - In the Firebug console, I see "200 OK" as result code when the ExtJS library requests it

XML data returned from the script:



<?xml version="1.0" encoding="iso-8859-1" ?>
<calls>
<call>
<number>15416</number>
<description>aae</description>
<dateentered>2010-09-15 10:44</dateentered>
</call>
</calls>




My ExtJS code:



var store = new Ext.data.GroupingStore({
url: 'main_xml.asp',
autoLoad: false,
reader: new Ext.data.XmlReader
(
{
record: "call"
},
['number', 'description', 'dateentered']
)
});

var groupview = new Ext.grid.GroupingView({
forceFit: true,
//groupTextTpl: '{group} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
groupTextTpl: '{group}',
onLoad: Ext.emptyFn
});

var grid = new Ext.grid.GridPanel({
store: store,
view: groupview,
columns: [
{header: "Numero de requete", width: 175, dataIndex: 'number'},
{header: "Sommaire", width: 150, dataIndex: 'description'},
{header: "Date d'entree", width: 75, dataIndex: 'dateentered'}
],
width:550,
height:440
});

store.load();


If I change the url config option to an actual XML file, it'll load OK. Is this due to some async. processing ? If so, what can I do ?

Thank you! :)

drunkmoose
17 Sep 2010, 11:30 AM
Nevermind.. It was the header's contentType not set to "text/xml".