grdLocalities.js 2.05 KB

//Ext.Loader.setPath('Ext.ux', 'extjs-4.2/examples/ux');
Ext.define('App.view.grdRouts', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.grdrouts',
    requires: [
        'Ext.data.*',
        'Ext.grid.*',
        'Ext.util.*',
        'Ext.toolbar.Paging',
    ],
   	frame: true,
	height:500,
	width:1000,
    initComponent: function () {
	       this.cellEditing = new Ext.grid.plugin.CellEditing({
            clicksToEdit: 2
        });
    Ext.apply(this, {
			store:'RouteStore',
			plugins: [this.cellEditing],
            tbar: [
			{
                text: 'Добавить',
                scope: this,
                action:'addroute'
            },
			{
                text: 'Удалить',
                scope: this,
                action: 'delete'
            }],

            columns: [
                  { 
				     header: 'Населенный пункт', 
				     dataIndex: 'titleszs', 
					 width: 500,
					 	 editor: {
								xtype: 'textfield',
								allowBlank: false
							}
				 },
				 {
				     header: 'Станция АГК', 
				     dataIndex: 'titleagk', 
					 renderer: this.renderAgkTitle,
					 width: 200,
						 editor: {
								xtype: 'textfield',
								allowBlank: false
							}
				 },
				 {
				 	header: 'Разрешить', 
				    dataIndex: 'enabled', 
					width:90,
					renderer: this.renderImgEnabled,
					editor: {	
                    xtype: 'checkbox',
                    boxLabel: 'Разрешить',
                    scope: this
                }
				}
				 ],
				  
            bbar: {
                xtype: 'pagingtoolbar',
                pageSize: 10,
				store:'RouteStore',
                displayInfo: true,
                displayMsg: 'Показано  {0} - {1} из {2}'
             
            }
        });
        this.callParent();
    },
	
	renderImgEnabled:function (value, p, record) {
		if (value)
			return '<img src="content/enabled.png" height="16px" width="16px">'
		else
				return '<img src="content/disabled.png" height="16px" width="16px">'
    }

});