grdNotifications.js 2.49 KB

//Ext.Loader.setPath('Ext.ux', 'extjs-4.2/examples/ux');

Ext.define('App.view.grdNotifications', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.grdnotifications',
    requires: [
        'Ext.data.*',
        'Ext.grid.*',
        'Ext.util.*',
        'Ext.toolbar.Paging'
    ],

   	frame: true,
    initComponent: function () {
	       this.cellEditing = new Ext.grid.plugin.CellEditing({
            clicksToEdit: 2
        });
    Ext.apply(this, {
			store:'NotificationStore',
			plugins: [this.cellEditing],
            columns: [
                  { 
				     header: 'Станция АГК №', 
				     dataIndex: 'number', 
					 width: 500	 
				 },
				 {
				     header: 'Река', 
				     dataIndex: 'river', 
					 renderer: this.renderAgkTitle,
					 width: 200,
				 },
                 {
                 	header: 'Контейнер',
                    dataIndex: 'opendoor',
                    width: 90,
                 	renderer: this.renderImgEnabled,
                    editor: {
                 		         xtype: 'checkbox',
                 		         boxLabel: 'Разрешить',
                 		         scope: this
                 		     }
               },
				 {
				     header: 'СЗС',
				     dataIndex: 'notification',
                     
				     width: 90,
				     renderer: this.renderImgEnabled,

				     editor: {
				         xtype: 'checkbox',
				       
				         boxLabel: 'Разрешить',
				         scope: this
				     }
				 },
                  {
                    header: 'Телефон', 
                    dataIndex: 'notificationphone',
                    
                    width:90,
                    renderer: this.renderImgEnabled,
                    editor: {	
                        xtype: 'checkbox',
                        action: 'ckphone',
                      boxLabel: 'Разрешить',
                    scope: this
                 }
				}
				 ],
			/*	  
            bbar: {
                xtype: 'pagingtoolbar',
                pageSize: 10,
				store:'NotificationStore',
                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">'
    }

});