grdRouts.js 2.27 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',
		'App.view.ddlSubscribers',
		'App.view.ddlAgks',
		'App.view.ddlAgksRouts'
    ],

   // xtype: 'sliding-pager',
   	frame: true,
    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'
            }
			,
            {
				xtype:'ddlsubscribers',
				id:'ddlsubscribers',
				name:'ddlsubscribers',
				action: 'ddlsubscribers'
			},
			{
				xtype:'ddlagksrouts',
				id:'ddlagksrouts',
				name:'ddlagksrouts',
				action: 'ddlagksrouts'
			}
            ],
            columns: [
                  { 
				     header: 'Подписчик', 
				     dataIndex: 'titleszs', 
					 width: 300	 
				 },
				 {
				     header: 'Станция АГК', 
				     dataIndex: 'titleagk', 
					 renderer: this.renderAgkTitle,
					 width: 350,
					 editor: 
					 {
						xtype:'ddlagks'
		
					 
					 }
				 },
				 {
				 	header: 'Разрешить', 
				    dataIndex: 'enabled', 
					flex:1,
					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="12px" width="12px">'
		else
				return '<img src="content/disabled.png" height="12px" width="12px">'
    }

});