Results 1 to 2 of 2

Thread: XML hasMany association not working in version 5.0.1.1255, works fine in 5.1

    Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Sencha Premium Member
    Join Date
    Jan 2015
    Posts
    1

    Default XML hasMany association not working in version 5.0.1.1255, works fine in 5.1

    The following code does not properly load associated data in 5.0.1, but works in 5.1. I can not currently upgrade to 5.1, and am looking for an easy workaround for 5.0.1. I have validated this using Fiddle with the both the latest version of 5.1 and the listed version of 5.0.1. Any help would be greatly appreciated:

    //read Data Package guide http://docs.sencha.com/ext-js/4-0/#!/guide/data
    Ext.define('IntegrationPackBinding', {
    extend: 'Ext.data.Model',

    fields: [{
    name: 'name',
    mapping: '@name',
    type: 'string'
    }],


    hasMany: {
    model: 'IntegrationPackBindingField',
    name: 'bindingFields',
    associationKey: 'Fields',

    reader: {
    type : 'xml',
    model: 'IntegrationPackBindingField',
    record: 'Field'
    }
    },

    proxy: {
    type: 'memory',
    reader: {
    type: 'xml',
    root: 'Bindings',
    record: 'Binding'
    }
    }
    });


    Ext.define('IntegrationPackBindingField', {
    extend: 'Ext.data.Model',
    fields: [{
    name: 'name',
    mapping: '@name',
    type: 'string'
    }, {
    name: 'type',
    mapping: '@type',
    type: 'string'
    },{
    name: 'defaultValue',
    mapping: '@defaultValue',
    type: 'string',
    defaultValue: ''
    }]
    });




    var rawXML = '<?xml version="1.0" encoding="utf-8" ?><ConnectionWizardTemplate><ConnectionWizardWindow><Bindings><Binding name="DataSourceConnection"><Fields><Field name="ConnectionID" type="int" /><Field name="DataSourceID" type="string" /><Field name="RemoteServerName" type="string" /><Field name="RemoteDatabaseName" type="string" /><Field name="RemoteServerPort" type="string" /><Field name="RemoteAuthenticationType" type="int" defaultValue="3" /><Field name="RemoteUsername" type="string" /><Field name="RemotePassword" type="string" /><Field name="IsFunctional" type="bool" defaultValue="false" /><Field name="Status" type="string" /><Field name="APISettings" type="string" /></Fields></Binding></Bindings></ConnectionWizardWindow></ConnectionWizardTemplate>';


    var doc;
    if (window.ActiveXObject) { //IE
    doc = new ActiveXObject("Microsoft.XMLDOM");
    doc.async = "false";
    doc.loadXML(rawXML);
    } else { //Mozilla
    doc = new DOMParser().parseFromString(rawXML, "text/xml");
    }


    debugger;
    var oStore = Ext.create('Ext.data.Store', {
    id: 'IntegrationPackBindingStoreID',
    model: 'IntegrationPackBinding',
    data: doc,
    proxy: {
    type: 'memory',
    reader: {
    type: 'xml',
    record: 'Binding',
    rootProperty: 'Bindings'
    }
    }
    });




    var records = new Array();
    var test = oStore.each(function(rec){
    records.push(rec);
    });


    console.log(records);


    Ext.application({
    name: 'Fiddle',


    launch: function () {
    //Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
    }
    });

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report. I tried to find the bug ticket for this fix to help with a workaround, but unfortunately I couldn't find a match.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •