Ext.define("App.view.CustomerOrderItemGrid", {
    extend: "Ext.grid.Panel",
    xtype: "customerOrderItemGrid",
    params: {},
    viewConfig : {
        enableTextSelection: true
    },

    loadStore:function(orderId){
        var store = this.getStore();
        Ext.apply(store.getProxy().extraParams,{
            orderId: orderId
        });
        store.load();
    },


    initComponent: function () {
        var me = this;
        
        me.store = Ext.create('App.store.ItemStore',{
        });
        me.columns = [
            {
                xtype:'rownumberer',
            },
            {
                xtype:'gridcolumn',
                dataIndex:'name',
                text: App.localeRes("Item"),
                flex: 3,
                cellWrap: true,
                renderer: function (value, metaData, record, row, col, store, grid) {
                    var data = record.data;
                    htmlStr = '';
                    htmlStr += '<div style="padding: 5px 0px 0px 10px;">' + App.nl2br(value) + '</div>';

                    return htmlStr;
                }
            },
            {
                xtype: 'floatcolumn',
                dataIndex: 'price',
                flex: 1,
                text: App.localeRes('Unit Price'),
            }
        ];


        me.callParent(arguments);
    }
});
