VecDefGrid.js 2.59 KB
Ext.define('treps.view.Steps.TransformationDefinition.VecDefGrid' ,{
        extend: 'Ext.grid.Panel',

        alias: 'widget.vecdef_grid',

	title: 'Vectors Definition',

	colRenderer: Ext.emptyFn,

	controllers: [
		'Vectors.VecDefGrid'
	],

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

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

        /*layout: {
                type: 'fit',
                padding: 5,
                margin: 5
        },*/

	autoScroll: true,

	columns: [
                {
                        header: 'Comp. 1',
			tooltip: 'First vector component',
			dataIndex: 'comp_1',
			renderer: function (value, metaData, record, row, col, store, gridView)
				{
					if (this.colRenderer)
						return this.colRenderer(value, metaData, record, row, col, store, gridView);
					else
						return value;
				},
			flex: 2
                },
		{
			header: 'Comp. 2',
			tooltip: 'Second vector component',
			dataIndex: 'comp_2',
                        renderer: function (value, metaData, record, row, col, store, gridView)
				{
					if (this.colRenderer)
						return this.colRenderer(value, metaData, record, row, col, store, gridView);
					else
						return value;
				},
			flex: 2
		},
		{
			header: 'Comp. 3',
			tooltip: 'Third vector component',
			dataIndex: 'comp_3',
                        renderer: function (value, metaData, record, row, col, store, gridView)
				{
					if (this.colRenderer)
						return this.colRenderer(value, metaData, record, row, col, store, gridView);
					else
						return value;
				},
			flex: 2
		},
		{
			xtype : 'checkcolumn',
			header: 'Pos.',
			tooltip: 'If checked, the vector represents a position in km',
			dataIndex: 'is_pos',
			flex: 1
		}
        ],

	tbar: [
		{
			xtype: 'button',
			id: 'addVecButton',
			text: 'Add',
			iconCls: 'icons-16x16-add'
		},
		{
			xtype: 'button',
			id: 'removeVecButton',
			text: 'Remove',
			iconCls: 'icons-16x16-remove'
		},
		{
			xtype: 'button',
			id: 'editVecButton',
			text: 'Edit',
			iconCls: 'icons-16x16-edit'
		},
		{
			xtype: 'combobox',
			id: 'srcUnit',
			editable: false,
			queryMode: 'local',
			emptyText: 'No unit',
			fieldLabel: 'Unit',
			valueField: 'kmvalue',
			autoSelect: true,
			labelWidth: 30,
			width: 160,
			padding: 5,
			tpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'<div class="x-boundlist-item">{fullname}</div>',
				'</tpl>'
			),

			displayTpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'<tpl if="id">',
						'{id}',
					'<tpl else>',
						'',
					'</tpl>',
				'</tpl>'
			)
		}




	]
});