grdLiveSubscribers.js 3.47 KB

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

Ext.define('App.view.grdLiveSubscribers', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.grdlivesubscribers',
    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: 'LiveSubscribersStore',
        plugins: [this.cellEditing],
            columns: [{ 
							 header: 'Подписчики', 
							 dataIndex: 'subscriber', 
							 width: 170	 
						},
						{
							 header: 'Дата/время', 
							 dataIndex: 'datetime', 
							 width: 120
						},
						{
								header:'Статус',
								dataIndex:'status',
								width:60,
								renderer:this.renderImgEnabled
						},
                        {
                            header:'Версия ПО',
                            dataIndex: 'softversion',
                            width:80
                        },
						{
							header: 'GUID', 
							dataIndex: 'regkey', 
							width:270
						},
                         {
                             header: 'Телефон', 
                             dataIndex: 'phone', 
                             width:200,
                             editor: {
                                 allowBlank: false
                             }
                         },

                          {
                              header: 'Тел. для.СЗС',
                              dataIndex: 'phoneszs',
                              width: 200,
                              editor: {
                                  allowBlank: false
                              }
                          },

                        
                            {
                               header: 'Сирена',
                               dataIndex: 'siren',
                               renderer: this.renderImgEnabledSiren,
                               width: 200,
                               editor: {
                                   xtype: 'checkbox',
                                   boxLabel: 'Разрешить',
                                   scope: this
                               }
                            },

                            {
                                header: 'ID Team Viewer',
                                dataIndex: 'idteamviewer',
                                width: 100
                            }
				 ]
				  
          
        });
        this.callParent();
   	},

   	renderImgClaim: function (value, p, record) {
   	    if (value) {
   	        console.log(true);
   	        return '<img src="content/claimtrue.png" height="30px" width="30x">'
   	        
   	    }
   	    else {
   	        console.log(false);
   	        return '<img src="content/claimfalse.png" height="30px" width=30px">'
   	    }
   	},
	
	renderImgEnabled:function (value, p, record) {
		if (value)
			return '<img src="content/online.png" height="20px" width="20x">'
		else
				return '<img src="content/offline.png" height="20px" width="20px">'
	},


    renderImgEnabledSiren: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">'
    }


});