Tuesday, May 1, 2012

urldecode xml attribute , mapping , convert


Ext.define('MyApp.model.MyModel', {
    extend: 'Ext.data.Model',

    fields: [
        {
            convert:function(v,rec){
                   return unescape(v);
            }   ,
            mapping: '@label',
            name: 'label',
            type: 'string'
        }
    ]
});


<?xml version="1.0" encoding="UTF-8"?>
<explorer >
<node label="%20Feng%20Guideline%20" type="GUIDELINE" nodeid="9740015D-3447-1CC6-949E-C91D0876F8D1" selected="true" version="0.34" seqnum="" year="2012" versionid="D956A51D-A9A8-8398-B191-79A44A97D75F">
</node>
</explorer>


Ext.define('MyApp.view.BottomPanel', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.bottompanel',

    height: 150,
    id: 'bottompanel',
    title: 'My Panel',

    initComponent: function() {
        var me = this;
        Ext.applyIf(me, {
            tpl:      [
                'Label: {label}<br>'
               ]
        });

        me.callParent(arguments);
    }

});

No comments: