PDA

View Full Version : read xml and load into form



coloradocanyon
8 Jan 2015, 12:46 AM
<?xml version="1.0" encoding="iso-8859-1" ?>
<operacion>
<Operacion>
<![CDATA[
...
]]>
</Operacion>
<Tabla>
<![CDATA[
...
]]>
</Tabla>
<propiedades>
<propiedad>
<Propiedad>
...
<edicion>
<Propiedad>
<![CDATA[
...
]]>
</Propiedad>
<ControlClass>
<![CDATA[
...
]]>
</ControlClass>
<CharCase>
<![CDATA[
...
]]>
</CharCase>
<Hint>
<![CDATA[
...
]]>
</Hint>
<ReadOnly>
<![CDATA[
...
]]>
</ReadOnly>
<ShowHint>
<![CDATA[
...
]]>
</ShowHint>
<Visible>
<![CDATA[
...
]]>
</Visible>
<WordWrap>
<![CDATA[
...
]]>
</WordWrap>
</edicion>
</Propiedad>
</Propiedad>
</propiedades>
</operacion>


hi all and happy new year, I have a problem, as I read this XML file and load it into a form ?.

greetings and thanks ....

coloradocanyon
9 Jan 2015, 1:12 AM
Ext.define('modelEditor',{ extend: 'Ext.data.Model', proxy: { type: 'ajax', reader: 'xml' }, fields: [ {name: 'Operacion', mapping: 'Operacion >'} ] }); //
create the Data Store var storeEditor = Ext.create('Ext.data.Store', { model: 'modelEditor', proxy: { type: 'ajax', url: 'opBasica.xml', reader: { type: 'xml', record: 'operacion', totalRecords: '@total' } }, autoLoad : true, listeners: { load: function(store, records) { console.log("load"); storeEditor.each(function(rec) { console.log('data...'); console.log(rec.get('Operacion')); }); } } });

I have done some testing in this case does not execute "storeEditor.each" instruction.

greetings and thanks ....

coloradocanyon
12 Jan 2015, 3:53 AM
nobody works with xml files? :-(

Gary Schlosberg
12 Jan 2015, 9:08 AM
Nothing jumps out at me. Here's a working example from the docs that might help:
http://docs.sencha.com/extjs/4.2.1/#!/example/form/xml-form.html