1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    15
    Answers
    1
    Vote Rating
    0
    snellessen is on a distinguished road

      0  

    Default Unanswered: Model Form binding with XML

    Unanswered: Model Form binding with XML


    Hi!

    I have a little problem.

    I have the following Script, where I want to get back a XML.
    But I dont get the values set inside the model & dont know how to get a XML back.

    Could you please help me out with this?



    Code:
    Ext.define('MyApp.view.MyFormPanel', {
        extend: 'Ext.form.Panel',
    
    
        config: {
            id: 'form',
            items: [
                {
                    xtype: 'fieldset',
                    modal: true,
                    title: 'TestFieldSet',
                    items: [
                        {
                            xtype: 'textfield',
                            label: 'Id',
                            name: 'number'
                        },
                        {
                            xtype: 'textfield',
                            label: 'Name',
                            name: 'name'
                        }
                    ]
                }
            ]
        },
    
    
        initialize: function() {
            this.callParent();
            var fields = [{name:'number', type:'string'},{name:'name', mapping:'name', type:'string'}];
    
    
            var ticketModel = Ext.define('TicketModel',
                {
                    extend:'Ext.data.Model',
                    config:{
                        fields:fields,
                        proxy: {
                            type: 'memory',
                            reader: {
                                type: 'xml',
                                record: 'data',
                                root:'root'
                            },
                            writer: {
                                type: 'xml',
                                record: 'data',
                                root:'root'
                            }
                        }
                    }
    
    
                });
    
    
            var ticketString = "<?xml version='1.0' encoding='UTF-8'?>"+
            "<root>"+
            "<data>"+
            "<number>12356478</number>"+
            "<name>Andreas</name>"+
            "</data>"+
            "</root>";
    
    
            var ticket = XMLtoDOM(ticketString);
    
    
            var newModel = Ext.create('TicketModel',ticket);
            this.setRecord(newModel);
    
    
           var ticket = XMLtoDOM(ticketString);
            function XMLtoDOM(xml){
                var xmlDom;
                if (window.ActiveXObject) { 
                    xmlDom = new ActiveXObject("Microsoft.XMLDOM"); 
                    xmlDom.async = "false"; 
                    xmlDom.loadXML(xml); 
                } else { 
                    xmlDom = new DOMParser().parseFromString(xml,"text/xml"); 
                }
                return xmlDom;
            }
        }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Why are you doing this? Why are you hurting performance to create XML client side and not just use an object?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2013
    Location
    Hamburg
    Posts
    1
    Vote Rating
    0
    keisbrenner is on a distinguished road

      0  

    Default


    Hi,
    additional info to this question above:
    We get the xml data using a soap request - the content is a xml string, that is being loaded to the store.

    after changing the data in die form, we want to get the updated contents back as an xml document (or string),
    so we can send this back to the soap server.

    it'd be much easier to use the document, so we have the format used in the input-data in the output data as well - an this format is the one the server expects.

    so creating an object before and create xml later from that object would be much heavier.

    so we need the information, how to get the data as xml /document or string) back to use that in further source.

  4. #4
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    15
    Answers
    1
    Vote Rating
    0
    snellessen is on a distinguished road

      0  

    Default


    We are creating the XML clientside just for testing and we need XML for our soap so we cn not use a object.

    Right now I´m at a Point, were i write changes inside the raw document. That works.. but is not the right way, i guess.

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar