PDA

View Full Version : Extjs Calendar and XML Store



comdata
12 Oct 2010, 1:53 PM
Hi,

I tried the new Calendar from the Extjs 3.3 examples and made a local version of it.

Unfortunately my backend will later on not be able to provide JSON date, so I tried using the XML Store with a local file modeled after the JSON store.

I replaced this assignment in the application:


this.eventStore = new Ext.data.XmlStore(
{
// store configs
autoLoad : true,
storeId : 'eventStore',
url : 'events.xml',
record : 'Row', // records will have an "Item" tag
idPath : 'id',
fields : [ 'id', 'cid', 'title', {name:'start', type: 'date'}, {name:'end', type: 'date'}, 'ad',
'notes' ]
});



and added the following XML as events.xml:


<?xml version="1.0" encoding="UTF-8"?>
<Rowsets>
<Rowset>
<Row>
<id>1001</id>
<cid>1</cid>
<title>Vacation</title>
<start>10/12/2010 10:00:00 AM</start>
<end>10/12/2010 11:00:00 AM</end>
<ad>false</ad>
<notes>Have fun</notes>
</Row>
</Rowset>
</Rowsets>


For some reason everything works with the default JSON file but not with the XML.

Any ideas?

Kind Regards,
Comdata

Condor
13 Oct 2010, 2:58 AM
1. That file is not coming from the local filesystem I hope?
2. You need to define a dateFormat for both date/time fields.

comdata
13 Oct 2010, 3:14 AM
1. That file is not coming from the local filesystem I hope?

At the moment yes. Bad idea? Then I will put it up to a server.


2. You need to define a dateFormat for both date/time fields.

Yes put the type "date" to the field in the fields. Thought that will do the trick.

What is quite unfortunate is that this throws no error it 1. is the problem.

Kind Regards,
Comdata

Condor
13 Oct 2010, 3:33 AM
Attach an 'exception' event handler to the store to see what the error actually is.

1. Ext can't load data from the local filesystem (there is a workaround for current browsers, but new browsers, like IE9, no longer allow local file access from the browser).

2. If you don't specify a dateFormat for type:'date' fields it expects a string in system format (which is a bit unpredictable, because it is language dependant).

comdata
14 Oct 2010, 11:35 AM
Ok. Run this now from a server and at least in the month view the enty is there. But in the other views it is missing. Am I doing something wrong? I am using the code from the examples.

Condor
15 Oct 2010, 3:18 AM
The example works with JSON data, so it is either caused your XmlStore config or your XML data.

Can you post both for the stores that aren't working?