Ext.define("App.view.WorkshopItemGrid", {
    extend: "Ext.grid.Panel",
    xtype: "workshopItemGrid",
    params: {},

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

        store.loadPage(1, {
            params: {start: 0},
            callback: function (records, operation, success) {}
        });
    },

    initComponent: function () {
        var me = this;

        Ext.apply(me, {
            tbar: {
                padding: 0,
                items: [
                    {
                        xtype: 'label',
                        html: "<b>" + App.localeRes('Item') + "</b>",
                        padding: '10 4 10 4'
                    },
                ]
            },
            store: Ext.create('App.store.WorkshopItemStore', {}),
            columns: [
                {
                    xtype: 'rownumberer',
                    text: '',
                    width: 80,
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'name',
                    flex: 3,
                    cellWrap: true,
                    text: App.localeRes('Item Name'),
                    renderer: function (value, metaData, record, row, col, store, grid) {
                        htmlStr = '';
                        htmlStr += '<div style="padding: 5px 0px 0px 10px;">' + App.nl2br(value) + '</div>';
                        return htmlStr;
                    }
                },
            ]
        });
        me.callParent(arguments);
    }
});