Skip to content
Snippets Groups Projects
dict.js 1.35 KiB
Newer Older
/**
 * dict.js
 *
 * Script to test the Dict form field.
 *
 */

// Activate the dynamic loading for Ext JS and application classes
App.setDynamicLoading(App.debug);

// classes required by the script
Ext.require('Ext.form.Panel');
Ext.require('Ext.tip.QuickTipManager');
Ext.require('App.form.field.Dict');

Ext.onReady(function(){

    "use strict";

    var form;

    Ext.QuickTips.init();

    form = Ext.create('Ext.form.Panel', {
        title: 'Dict',
        bodyPadding: 5,
        width: 350,
        layout: 'anchor',
        defaults: {
            anchor: '100%'
        },
        items: [{
            fieldLabel: 'MyText',
            xtype: 'textfield'
        }, {
            fieldLabel: 'MyDict',
            xtype: 'xdictfield',
            value: {
                "(name)": "My string",
                "Created": new Date(Date.parse('10/15/2006')),
                "Available": false,
                "Version": 0.01,
                "Description": "A test string"
            },
            hideHeader: false,
            modifyKeys: true,
            listeners: {
                keychange: {
                    fn: function (cmp, action, oldKey, newKey) {
                        Ext.Msg.alert('Event', action + ' ' + oldKey + ' ' + newKey);
                    }
                }
            }
        }],
        renderTo: Ext.getBody()
    });

});