4 * @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
5 * @author Philipp Schüle <p.schuele@metaways.de>
6 * @copyright Copyright (c) 2011 Metaways Infosystems GmbH (http://www.metaways.de)
9 Ext.ns('Tine.Admin.customfield');
13 * Customfield grid panel
15 * @namespace Tine.Admin.customfield
16 * @class Tine.Admin.customfield.GridPanel
17 * @extends Tine.widgets.grid.GridPanel
19 Tine.Admin.customfield.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
24 newRecordIcon: 'admin-action-add-customfield',
25 recordClass: Tine.Admin.Model.Customfield,
26 recordProxy: Tine.Admin.customfieldBackend,
27 defaultSortInfo: {field: 'name', direction: 'ASC'},
31 autoExpandColumn: 'name'
37 initComponent: function() {
38 this.gridConfig.cm = this.getColumnModel();
39 Tine.Admin.customfield.GridPanel.superclass.initComponent.call(this);
43 * returns column model
45 * @return Ext.grid.ColumnModel
48 getColumnModel: function() {
49 return new Ext.grid.ColumnModel({
55 columns: this.getColumns()
64 getColumns: function(){
66 { header: this.app.i18n._('ID'), id: 'id', dataIndex: 'id', width: 50},
67 { header: this.app.i18n._('Label'), id: 'label', dataIndex: 'definition', hidden: false, width: 100, renderer: this.labelRenderer.createDelegate(this)},
68 { header: this.app.i18n._('Name'), id: 'name', dataIndex: 'name', hidden: false, width: 75},
69 { header: this.app.i18n._('Type'), id: 'xtype', dataIndex: 'definition', hidden: false, width: 75, renderer: this.typeRenderer.createDelegate(this)},
70 { header: this.app.i18n._('Application'), id: 'application_id', dataIndex: 'application_id', hidden: false, width: 100, renderer: this.appRenderer.createDelegate(this)},
71 { header: this.app.i18n._('Model'), id: 'model', dataIndex: 'model', hidden: false, width: 100}
78 * @param {Object} value
81 labelRenderer: function(value) {
82 return this.app.i18n._(value.label);
88 * @param {Object} value
91 typeRenderer: function(value) {
92 return this.app.i18n._(value.type);
96 * returns application name
98 * @param {Object} value
101 appRenderer: function(value) {
102 return this.app.i18n._(value.name);
106 * initialises filter toolbar
108 initFilterPanel: function() {
109 this.filterToolbar = new Tine.widgets.grid.FilterToolbar({
111 {label: this.app.i18n._('Customfield'), field: 'query', operators: ['contains']},
112 {filtertype: 'admin.application', app: this.app}
114 defaultFilter: 'query',
118 new Tine.widgets.grid.FilterToolbarQuickFilterPlugin()
121 this.plugins = this.plugins || [];
122 this.plugins.push(this.filterToolbar);
126 * on update after edit
128 * @param {String|Tine.Tinebase.data.Record} record
130 onUpdateRecord: function (record) {
131 Tine.Admin.customfield.GridPanel.superclass.onUpdateRecord.apply(this, arguments);
133 Tine.Tinebase.common.confirmApplicationRestart();
137 * do something after deletion of records
140 * @param {Array} [ids]
142 onAfterDelete: function (ids) {
143 Tine.Admin.customfield.GridPanel.superclass.onAfterDelete.apply(this, arguments);
145 Tine.Tinebase.common.confirmApplicationRestart();