1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    50
    Vote Rating
    0
    denisputnam is on a distinguished road

      0  

    Default How to get access to the data in other Tabs

    How to get access to the data in other Tabs


    I have the following code. I want to add a calculated column in the 'What' tab by accessing the data in the 'SpotPrices' tab. Can someone tell me how to do that? I think I have to use a renderer in the 'What' tab, but the trick is how to get a hold of the data in the 'SpotPrices' tab.

    Code:
    Ext.define('MyApp.view.MyStuffTabPanel', {
        extend: 'Ext.tab.Panel',
    
    
        height: 503,
        resizable: true,
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'panel',
                        height: 237,
                        resizable: true,
                        layout: {
                            type: 'fit'
                        },
                        title: 'What',
                        items: [
                            {
                                xtype: 'gridpanel',
                                height: 503,
                                autoScroll: true,
                                resizable: true,
                                title: 'WhatGridPanel',
                                store: 'MyWhatStore',
                                viewConfig: {
                                    height: 503
                                },
                                columns: [
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'what',
                                        text: 'What'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'amount',
                                        text: 'Amount'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'unit',
                                        text: 'Units'
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        xtype: 'panel',
                        height: 503,
                        resizable: true,
                        layout: {
                            type: 'fit'
                        },
                        title: 'SpotPrices',
                        items: [
                            {
                                xtype: 'gridpanel',
                                height: 503,
                                autoScroll: true,
                                resizable: false,
                                title: 'SpotPricesGridPanel',
                                forceFit: true,
                                store: 'MySpotPricesStore',
                                viewConfig: {
                                    height: 503,
                                    autoScroll: true,
                                    resizable: false
                                },
                                columns: [
                                    {
                                        xtype: 'gridcolumn',
                                        maxWidth: 50,
                                        width: 50,
                                        defaultWidth: 50,
                                        dataIndex: 'symbol',
                                        text: 'Symbol'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        maxWidth: 50,
                                        defaultWidth: 50,
                                        dataIndex: 'type',
                                        text: 'Type'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        maxWidth: 50,
                                        defaultWidth: 50,
                                        dataIndex: 'currency',
                                        text: 'Currency'
                                    },
                                    {
                                        xtype: 'datecolumn',
                                        maxWidth: 125,
                                        defaultWidth: 125,
                                        dataIndex: 'date',
                                        flex: 2,
                                        text: 'Date',
                                        format: 'Y-m-d H:i:s'
                                    },
                                    {
                                        xtype: 'datecolumn',
                                        maxWidth: 125,
                                        defaultWidth: 125,
                                        dataIndex: 'time',
                                        flex: 2,
                                        text: 'Time',
                                        format: 'Y-m-d H:i:s'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 50,
                                        defaultWidth: 50,
                                        dataIndex: 'rate',
                                        text: 'Rate'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 65,
                                        defaultWidth: 50,
                                        dataIndex: 'bid',
                                        text: 'Bid'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 65,
                                        defaultWidth: 65,
                                        dataIndex: 'ask',
                                        text: 'Ask'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 65,
                                        defaultWidth: 65,
                                        dataIndex: 'high',
                                        text: 'High'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 65,
                                        defaultWidth: 65,
                                        dataIndex: 'low',
                                        text: 'Low'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 70,
                                        defaultWidth: 70,
                                        dataIndex: 'oneDayPrice',
                                        text: 'Onedayprice'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 85,
                                        defaultWidth: 85,
                                        dataIndex: 'oneDayChangePercent',
                                        text: 'PercentChange'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        maxWidth: 80,
                                        defaultWidth: 80,
                                        dataIndex: 'oneDayChange',
                                        text: 'Onedaychange'
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        xtype: 'panel',
                        height: 503,
                        resizable: true,
                        title: 'Tab 3'
                    }
                ]
            });
    
    
            me.callParent(arguments);
        }
    
    
    });
    Last edited by aconran; 4 Oct 2012 at 10:13 AM. Reason: to fix the title.

Tags for this Thread