View Full Version : How to use XmlReader to map an attribute to an attribute setting on my TextField?

1 Nov 2009, 8:10 AM
I have the following XML which is taken from a tutorial:

<?xml version="1.0" encoding="UTF-8"?>
<message success="true">
<first disabled='true'>Jack</first>
<company disabled='true'>Ext JS</company>
<email>[email protected]</email>

Each field is mapped to their relevant ExtJs component as follows (here's a code snippet):

reader : new Ext.data.XmlReader({
record : 'contact',
success: '@success'
}, [
//Want to map the xml attribute to the html input attribute, not to the extjs model object - how to do this??
{name: 'disabled', mapping: '@disabled'},
{name: 'first', mapping:'name/first'}, // custom mapping
{name: 'last', mapping:'name/last'},
'company', 'email', 'state',
{name: 'dob', type:'date', dateFormat:'m/d/Y'} // custom data types

My Question is - how do I also use the "disabled" XML attribute to set whether or not the related ExtJs TextField is disabled or not? Ie it's resulting HTML "disabled" attribute = 'disabled'?

Many thanks