Ext.ns('ES');

ES.HeatingEditCounterForm = Ext.extend(Ext.FormPanel,{
  frame:true,
  border:true,
  labelWidth:150,
  height:180,
  width: 608,
  buttons: [{text: 'Sauver'}],
  layout:'form'
  ,buttonAlign:'right'
  ,frame:false
  ,border:true
  ,bodyStyle:'padding:10px'
  ,initComponent: function() {
    var config = {
      items:[{
        title:'Compteur chauffage : '
        ,layout:'form'
        ,xtype:'fieldset'
        ,border:false
        ,autoHeight:true
        ,defaultType:'textfield'
        ,bodyStyle:'padding:4px'
        ,items:[{
          name:'tree_node_id'
          ,fieldLabel:'Tree Node id'
          ,hidden: true
          ,hideLabel: true
        },{
          xtype:'TextField1'
          ,name:'heatingcountername'
          ,fieldLabel:'Nom du compteur chauffage'
          ,allowBlank:false
        }]
      }]
    };
     // apply config
    Ext.apply(this, Ext.apply(this.initialConfig, config));
    // call parent initComponent
    ES.HeatingEditCounterForm.superclass.initComponent.call(this);
   } // end of function initComponent
  ,onRender:function() {
    ES.HeatingEditCounterForm.superclass.onRender.apply(this, arguments);
    var unitCombo=this.items.itemAt(0).items.itemAt(3);
  }
  ,filterUnitComboBox:function(){
    var childCombo= this.items.itemAt(0).items.itemAt(3);
    childCombo.store.filter('energyId',1);
  }
  ,isValid:function (){
    return(this.getField('heatingcountername').isValid());
  }
  ,getField:function(fieldName){
    return this.getForm().findField(fieldName);
  }
  ,setField:function(fieldName,value){
    this.getField(fieldName).setValue(value);
  }
});

Ext.reg('ESheatingeditcounterform', ES.HeatingEditCounterForm);


