TimesPanel.js 1.29 KB
Ext.define('treps.view.Times.TimesPanel' ,{
	extend: 'Ext.form.Panel',

	alias: 'widget.times_panel',

	initComponent: function() {
		this.callParent(arguments);
	},

	title: 'Time Field',

	addcheckbox: false,

	tools: [
		{
			type: 'help',
			pageId: 'time'
		}
	],

	layout: {
		type: 'vbox',
		padding: 5,
		margin: 5,
		align: 'stretch'
        },

	items: [
		{
			xtype: 'combo',

			name: 'timeformat',

			fieldLabel: 'Time format',

			queryMode: 'local',

			editable: false,

			valueField: 'id',

			tpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'<tpl if="pattern">',
						'<div class="x-boundlist-item">{fullname} - {pattern}</div>',
					'<tpl else>',
						'<div class="x-boundlist-item">{fullname}</div>',
					'</tpl>',
				'</tpl>'
			),

			displayTpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'<tpl if="pattern">',
						'{fullname} - {pattern}',
					'<tpl else>',
						'{fullname}',
					'</tpl>',
                        	'</tpl>'
                        )
		},
		{
			xtype: 'textfield',
			name: 'timepattern',
			fieldLabel: 'Time pattern'
		}
	],

	listeners : {
		afterrender : function()
		{
			if (this.addcheckbox)
			{
				//insert chack box in header
				var check = Ext.create('Ext.form.field.Checkbox',{});
				this.header.insert(0,check);
			}
		}
	}
});