Ext.ns('ES');

ES.SiteCharacteristicGrid = Ext.extend(Ext.grid.GridPanel, {
  id: 'SiteCharacteristicGrid',
  enableHdMenu:false,
  autoload:true
  ,store: new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
      url:'/process/extjs/site/profil/sitecharacteristic/sitecharacteristic.php',
      method: 'POST'
    }),
    reader: new Ext.data.JsonReader({
      root: 'results',
      id: 'id'
      },[
        {name: 'tabletype', type: 'string', mapping: 'tabletype'},
        {name: 'tabletypeinfo', type: 'string', mapping: 'tabletypeinfo'},
        {name: 'tabletypeid', type: 'string', mapping: 'tabletypeid'},
        {name: 'lastValue', type: 'string', mapping: 'lastvalue'},
        {name: 'type', type: 'string', mapping: 'type'},
        {name: 'rowsnumber', type: 'string', mapping: 'rowsnumber'}
      ])
  })
  ,initComponent:function() {
    this.rowActionDetails = new Ext.ux.grid.RowActions({
      header:'Données'
      ,width: 66
      ,scope:this
      ,autoWidth:false
      ,hideMode:'display'
      ,keepSelection:true
      ,actions:[{
        iconCls:'icon-management'
        ,tooltip:'Modifier'
        ,textIndex:'rowsnumber'
      }]
//      ,callbacks:{
//        'icon-edit':function(grid, record, action, row, col) {
//          this.initEditPhysicDatasFormWindow2(grid, record, action, row, col);
//        }.createDelegate(this)
//      }
    });
    var config = {
      plugins:[this.rowActionDetails],
      tbar: new Ext.Toolbar({height:25}),
      cm: new Ext.grid.ColumnModel([
        {
          header: 'tabletype',
          dataIndex: 'tabletype',
          hidden:true,
          hideable:false
        },{
          header: 'tabletypeinfo',
          dataIndex: 'tabletypeinfo',
          hidden:true,
          hideable:false
        },{
          header: 'tabletypeid',
          dataIndex: 'tabletypeid',
          hidden:true,
          hideable:false
        },{
          header: 'type',
          dataIndex: 'type',
          width: 235,
          hideable:false
        },{
          header: 'Dernière Valeur',
          dataIndex: 'lastValue',
          width: 95,
          hideable:false
        },
        this.rowActionDetails
      ])
    };
     // apply config
    Ext.apply(this, Ext.apply(this.initialConfig, config));
    // call parent initComponent
    ES.SiteCharacteristicGrid.superclass.initComponent.call(this);
    this.doLayout();
  } // end of function initComponent
  ,onRender:function() {
    ES.SiteCharacteristicGrid.superclass.onRender.apply(this, arguments);
    this.refresh();
  } // eo function onRender
  ,refresh:function() {
    this.store.load({
         url:this.url
        ,waitMsg:'Loading...'
        ,params:{cmd:'list'}
    });
  }
});

Ext.reg('ESsitecharacteristicgrid', ES.SiteCharacteristicGrid);

