Show cool things you have done with our products


Post by java_bear »

I'm trying to use a static xml file for setting up a Scheduler.
The file seems to load, but the resource area of the Scheduler grid is empty.

I create a Resource store like this:
var resourceStore = Ext.create('Ext.data.XmlStore', {
                sorters:{
                    property: 'Name', 
                    direction: "ASC"
                },
                model : 'Sch.model.Resource',
                proxy: {
                	type: 'ajax',
                	url: 'output3.xml',
        			reader: {
        				type: 'xml',
        				record: 'Resource',
        				idProperty: 'Id',
        				successProperty: 'success'
        			}
                }
            }),
The file output3.xml is loaded according to Firebug.
The structure of the file is as follows:
<?xml version="1.0"?>
<ResourcePeriod xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
  <Resource>
    <Id>AB11111</Id>
    <Name>AB11111 Tekst</Name>
  </Resource>
  <Resource>
    <Id>ZX1234</Id>
    <Name>ZX1234 Tekst</Name>
  </Resource>
...
  <Event>
    <ResourceId>AB11111</ResourceId>
    <Id>8</Id>
    <Title/>
    <StartDate>2011-02-07</StartDate>
    <EndDate>2011-12-31</EndDate>
  </Event>
  <Event>
    <ResourceId>ZX1234</ResourceId>
    <Id>4</Id>
    <Title/>
    <StartDate>2011-01-10</StartDate>
    <EndDate>2011-09-23</EndDate>
  </Event>
</ResourcePeriod>
Is there something wrong with my XML or is the error related to my resourceStore definition?

Post by mats »

Works well for me, data is there:
var resourceStore = Ext.create('Ext.data.XmlStore', {
    sorters:{
        property: 'Name',
        direction: "ASC"
    },
    model : 'Sch.model.Resource',
    proxy: {
        type: 'ajax',
        url: 'output3.xml',
        reader: {
        type: 'xml',
        record: 'Resource',
        idProperty: 'Id',
        successProperty: 'success'
        }
    }
});

resourceStore.load({
    callback : function() {
        alert('store loaded, first name is : ' + this.first().get('Name'));
    }
});

Post Reply