// Create user extension namespace (Application)
Ext.namespace('Application');

/**
  *  Application.guestTovarPropGrid Extension class
  * 
  *  @author Seabor
  *  @version 1.0
  *  
  *  @class Application.guestTovarPropGrid
  *  @extends Ext.grid.GridPanel
  *  @constructor
  *  @param {Object} config Configuration options
  */

Application.guestTovarPropGrid = function(config) {

    // call parent constructor
    Application.guestTovarPropGrid.superclass.constructor.call(this, config);
    
    //store
    this.store = new Ext.data.JsonStore({
        autoLoad: false
        ,url: '/index/describe'
        //,baseParams: {tovar_id: tovar_id}
        ,fields: [{
            name: 'key', type: 'string'
        },{
            name: 'value', type: 'string'
        }]
        ,reader: new Ext.data.JsonReader({}, 
            new Ext.data.Record.create([{
                name: 'key', type: 'string'
            },{
                name: 'value', type: 'string'
            }])
        )
     });
            
}; // end of Application.guestTovarPropGrid constructor

Ext.extend(Application.guestTovarPropGrid, Ext.grid.GridPanel, {
    
    // configurables
    // anything what is here can be configured from outside
    stripeRows: true
    ,border: false
    ,cls: 'tovar-prop-grid'
    //,header: false
    ,autoExpandColumn: 'value'
    ,disableSelection: true
    ,hideHeaders: true
    ,columns: [{
        id:'key', header: "x", sortable: true, width:100, dataIndex: 'key'
    },{
        id:'value', header: "y", dataIndex: 'value', width:100, align: 'right'
    }]
    ,viewConfig: {
        forceFit: true
    }
        
});

// register new xtype
Ext.reg('guestTovarPropGrid', Application.guestTovarPropGrid);
