grdUpdInfo.js 2.96 KB

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

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

  //  xtype: 'sliding-pager',
   	frame: true,
	height:470,
	width:1000,
    initComponent: function () {
	       this.cellEditing = new Ext.grid.plugin.CellEditing({
            clicksToEdit: 2
        });
    Ext.apply(this, {
			store:'UpdInfoStore',
			plugins: [this.cellEditing],
            columns: [
						{ 
							 header: 'id', 
							 dataIndex: 'id', 
							 width: 50,
							 hide:true
						},
						{ 
							 header: 'СЗС', 
							 dataIndex: 'titleszs', 
							 width: 250,
							 hide:true
						},
						{ 
							 header: 'Обновление БД', 
							 dataIndex: 'dtupddb', 
							 width: 250,
							 hide:true
						},
						{ 
							 header: 'Обновление программы', 
							 dataIndex: 'dtupdsoft', 
							 width: 250,
							 hide:true
						},
						{ 
							 header: 'Загрузить', 
							 dataIndex: 'isdownload', 
							 width: 250,
							 renderer: this.renderImgTobeUpdate,
							 editor: {	
									xtype: 'checkbox',
									boxLabel: 'Загрузить',
									scope: this
									}
						},
						{ 
							 header: 'Обновить БД', 
							 dataIndex: 'isupddb', 
							 width: 250,
							 renderer: this.renderImgTobeUpdate,
							 editor: {	
									xtype: 'checkbox',
									boxLabel: 'Обновить БД',
									scope: this
									}
						},
						{ 
							 header: 'Обновить программу', 
							 dataIndex: 'isupdszs', 
							 width: 250,
							 renderer: this.renderImgTobeUpdate,
							 editor: {	
									xtype: 'checkbox',
									boxLabel: 'Обновить программу',
									scope: this
									}
						}								
				 ],
            bbar: {
					xtype: 'pagingtoolbar',
					pageSize: 10,
					store:'UpdInfoStore',
					displayInfo: true,
					displayMsg: 'Показано  {0} - {1} из {2}'
					
				  }
        });
        this.callParent();
    },
	
	renderImgToBeReload:function (value, p, record) {
		if (value)
			return '<img src="content/enabled.png" height="20px" width="20px">'
		else
				return '<img src="content/disabled.png" height="20px" width="20px">'
    },
	
	
		renderImgTobeUpdate:function (value, p, record) {
		if (value)
			return '<img src="content/enabled.png" height="20px" width="20px">'
		else
				return '<img src="content/disabled.png" height="20px" width="20px">'
    },
	renderImgIsUpdate:function (value, p, record) {
		if (value)
			return '<img src="content/updated.png" height="20px" width="50px">'
		else
				return '<img src="content/noupdate.png" height="20px" width="20px">'
    },

	renderImgStatus:function (value, p, record) {
		if (value)
			return 'Идет обновлене...'
		else
				return '';
    }
	
});