ext-all.js:38未捕获TypeError:无法读取未定义的属性'substring'

时间:2016-07-21 07:59:38

标签: javascript jquery extjs

我需要帮助识别错误“ ext-all.js:38未捕获的TypeError:无法读取未定义的属性'substring'”。当我试图将小部件加载到jsp中时,此错误在浏览器中显示。我的小部件代码如下

Ext.define('Treasury.view.CPPresettlementLimits', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.CPPresettlementLimits',
     height: 164,
    initComponent: function() {
        alert("Treasury.view.CPPresettlementLimits");
        var me = this;
        me.callParent(arguments);
    }

});

Ext.define('Treasury.view.CPPresettlementLimits', {
     extend: 'Ext.container.Container',
    alias: 'widget.CounterPartyPSLimitsPanelContainer',

    requires: [
        'Ext.panel.Panel'
    ],
    cls: '',
    height: 340,
    config: null,
    close: '',
    id: 'mypanel-cpps',
    setDisabled: false,
    chart: null,
    isConfigChart: 'N',
    isCheck: '',
    initComponent: function() {
        var me = this;
        me.isConfigChart = me.config.isChart;
        alert("CPPS Panel");
        var childItemsWindow = Array(
        {
            xtype: 'button',
            cls: 'ui-btn',
            id: 'cpps_table_expand',
            iconCls: "icon-table",
            handler: function (btn){
                console.log('inside the handler');debugger;
                if( $('#cpps_widgetfullscreen').css('display') === 'none' ) {
                    $('#cpps_widgetfullscreen').show();
                    $('#cpps_datagridfullscreen').hide();
                    $('#cpps_currencytypeexpand').hide();
                }
                else {
                    $('#cpps_widgetfullscreen').hide();
                    $('#cpps_datagridfullscreen').show();
                    $('#cpps_currencytypeexpand').show();
                }
            }
        }
        },
        {
            xtype: "button",
            cls: 'ui-btn',
            id: 'cpps_export_expand',
            iconCls: "icon-export",
            handler: function(b, e) {
                TU.exportGridToExcel(me.config.widgetID);
            }
        },
        {
            xtype: "button",
            cls: 'ui-btn',
            iconCls: "icon-print",
            id: 'cpps_print_expand',
            handler: function (btn){
                printCPContent();
            }
        },
        {
            xtype: 'button',
            cls: 'ui-btn',
            id:'cpps_drilldowntable_expand',
            iconCls: "dd-icon-table",
            style: {
                'border-width': '1px',
                'left': '838px',
                'top': '2px',
                'top/*\**': '4px\9',
                'margin': '0px'
            },
            listeners: {
                'beforerender': function() {
                    this.hide();
                }
            },
            handler: function (){
                if( $('#cpps_widgetfullscreendrilldown').css('display') === 'none' ) {
                    $('#cpps_widgetfullscreendrilldown').show();
                    $('#cpps_datagridfullscreendrilldown').hide();
                    $('#cpps_currencytypeexpand').hide();
                }
                else {
                    $('#cpps_widgetfullscreendrilldown').hide();
                    $('#cpps_datagridfullscreendrilldown').show();
                    $('#cpps_currencytypeexpand').show();
                }
            }
        },
        {
            xtype: 'button',
            cls: 'ui-btn',
            id:'cpps_drilldownback_expand',
            iconCls: "dd-icon-back",
            style: {
                'border-width': '1px',
                'left': '860px',
                'top': '2px',
                'top/*\**': '4px\9',
                'margin': '0px' 
            },
            listeners: {
                'beforerender': function() {
                    this.hide();
                }
            },
            handler: function (){
                if (isExpandMode) {
                    $('#cpps_widgetfullscreen').show();
                    $('#cpps_print_expand').show();
                    $('#cpps_export_expand').show();
                    $('#cpps_table_expand').show();
                    $('#cpps_reload_expand').show();
                    changeCPPSWidgetTitle(false,'WID19-window');
                    createFilterForCPPS(me.config.widgetID);
                    $('#cpps_drilldownback_expand').hide();
                    $('#cpps_drilldowntable_expand').hide();
                    $('#cpps_widgetfullscreendrilldown').hide();
                    $('#cpps_datagridfullscreendrilldown').hide();
                    $('#cpps_currencytypeexpand').hide();
                }

            }
        },
        {
            xtype: "button",
            cls: 'ui-btn',
            iconCls: "icon-close",
            handler: function () {
                isDrillDownForCPPS = false;
                this.up('.window').close();
                TU.setWidgetResetDataForCPPS(me.config.widgetID,TU.widgetsLevelPrefData[me.config.widgetID].data);
                isExpandMode = false;
                piechartdrillID = 'piechartdrill';
                cppslimitstbldrillID = 'cppslimitstbldrill';
            }
        });
        var childItems = Array({
            xtype: 'button',
            cls: 'ui-btn',
            id: 'cpps_table', 
            iconCls: "icon-table",
            handler: function () {
                if( $('#cppswidget').css('display') === 'none' ) {
                    $('#cppswidget').show();
                    $('#cppslimitstbl').hide();
                    TU.setWidgetsState(me.id.split('-')[0], 'Y');
                    alert("Child item array");
                    if(typeof me.close !== 'undefined' && me.close === 'Y') {
                        me.isConfigChart = 'Y';
                    }
                    $('#currencytype').hide();
                }
                else {
                    $('#cppswidget').hide();
                    $('#cppslimitstbl').show();
                    TU.setWidgetsState(me.id.split('-')[0], 'N');
                    if(typeof me.close !== 'undefined' && me.close === 'Y') {
                        me.isConfigChart = 'N';
                    }
                    $('#currencytype').show();
                }
            }
        },
        {
            xtype: 'button',
            cls: 'ui-btn',
            id:'cpps_drilldowntable',
            iconCls: "icon-table",
            style: {
                'border-width': '1px',
                'left': '252px',
                'top': '2px',
                'margin': '0px'
            },
            listeners: {
                'beforerender': function() {
                    this.hide();
                }
            },
            handler: function (){
                if( $('#piechartdrill').css('display') === 'none' ) {
                    $('#piechartdrill').show();
                    $('#cppslimitstbldrill').hide();
                }
                else {
                    $('#piechartdrill').hide();
                    $('#cppslimitstbldrill').show();
                }
            }
        },
        {
            xtype: 'button',
            cls: 'ui-btn',
            id:'cpps_drilldownback',
            iconCls: "icon-back",
            style: {
                'border-width': '1px',
                'left': '278px',
                'top': '2px',
                'margin': '0px' 
            },
            listeners: {
                'beforerender': function() {
                    this.hide();
                }
            },
            handler: function (){
                if (isExpandMode) {
                    $('#cpps_widgetfullscreen').show();
                }
                else {
                    $('#cppswidget').show();
                    $('#cpps_expand').show();
                    $('#cpps_table').show();
                    $('#cpps_reload').show();
                    changeCPPSWidgetTitle(false,'WID19');
                    $('#cpps_drilldownback').hide();
                    $('#cpps_drilldowntable').hide();
                }
            }
        },
        {
            xtype: "button",
            cls: 'ui-btn',
            id: 'cpps_reload',
            iconCls: "icon-reload",
            handler: function (){
                reloadDataGridCPPS(me.config.widgetID);
            }
        });
        if (!(typeof me.close !== 'undefined' && me.close !== 'N')) {
            childItems[childItems.length] = {
                xtype: 'button',
                cls: 'ui-btn',
                id: 'cpps_expand',
                iconCls: 'icon-expand',
                handler: function (btn) {
                    isExpandMode = true;
                    piechartdrillID = 'cpps_widgetfullscreendrilldown';
                    cppslimitstbldrillID = 'cpps_datagridfullscreendrilldown';
                    isDrillDownForCPPS = true;
                    var cpwindow = new Ext.Window({
                        title: me.config.widgetName,
                        layout: 'absolute',
                        modal: 'true',
                        renderTo: Ext.getBody(),
                        layout: 'fit',
                        resizable: false,
                        draggable: false,
                        width: 960,
                        height: 380,
                        closable:false,
                        plain: true,
                        id: me.config.widgetID+'-window',
                        cls: 'ui-pop-window',
                        html: '<div id="printWidget"><div class="lastupdatetimecontainer"><span class="bold">'+TC.LAST_UPDATED+':</span>&nbsp;<span id="cplastupdatetime"> </span></div><div id="cpps_currencytypeexpand"  class="currencytype hide">'+TC.CURRENCY_TYPE_USD+'</div><div id="cpps_widgetfullscreen" class="widget-container" style="display: none;"></div><div id="cpps_datagridfullscreen" class="widget-container" style="display: none;"></div><div id="cpps_widgetfullscreendrilldown" class="widget-container" style="display: none;"></div><div id="cpps_datagridfullscreendrilldown" class="widget-container" style="display: none;"></div></div>',
                        tools:childItemsWindow,
                        listeners: {
                            render: function() {
                                me.tbl = createCPPSDataGrid(me.config.widgetID,'cpps_datagridfullscreen', 'cpps_widgetfullscreen');
                                createFilterForCPPS(me.config.widgetID);
                                if( me.config.isChart === 'Y' ) {
                                    $('#cpps_widgetfullscreen').show();
                                    $('#cpps_datagridfullscreen').hide();
                                }
                                else {
                                    $('#cpps_widgetfullscreen').hide();
                                    $('#cpps_datagridfullscreen').show();
                                }
                                isExpandMode = true;
                            }
                        }
                    });
                    cpwindow.show();
                }
            };
        };

        if(me.isCheck === 'Y'){
            if (typeof me.close !== 'undefined' && me.close !== 'N') {
                childItems[childItems.length] = {
                    xtype: "button",
                    cls: 'ui-btn',
                    iconCls: (this.setDisabled ? "icon-checked" : "icon-unchecked"),
                    handler: function (btn) {
                        var tempWidgetID;
                        if (me.config.isChart === 'Y' ) {
                            tempWidgetID = me.config.widgetID + '-chartContainer'; 
                        }
                        else {
                            tempWidgetID = me.config.widgetID + '-chartContainer'; 
                        }
                        var tempXtype = TU.widgetsArray[me.config.widgetID];
                        if(typeof tempXtype !== 'undefined') {
                            var tempConfigObj = {
                                'xtype': tempXtype,
                                'id': me.config.widgetID,
                                'cls': 'columnleft',
                                'config': me.config,
                                'isCheck': 'Y',
                                'listeners': {
                                    'beforerender': function() {
                                        this.hide();
                                    },
                                    'render': function() {
                                        me.tbl = createCPPSDataGrid(me.config.widgetID);
                                        this.show();
                                    }
                                }
                            };
                            //if( $('#' + btn.id).find('span[class="x-btn-icon icon-unchecked"]').length > 0 && $('#' + btn.id).find('span[class="x-btn-icon icon-unchecked"]').css('background-image').endsWith('unchecked.png)') ) {
                            //if()
                            if( $('#' + btn.id).find('span[class="x-btn-icon icon-unchecked"]').length > 0 ) {
                                $('#' + btn.id).find('span[class="x-btn-icon icon-unchecked"]').removeClass('icon-unchecked').addClass('icon-checked');
                                $('#' + tempWidgetID).fadeOut('slow', function() {
                                    Ext.getCmp(tempWidgetID).destroy();
                                    tempConfigObj['setDisabled']  = true;
                                    Ext.getCmp('widgetslist').insert(0, tempConfigObj);
                                });
                            }
                            else {
                                $('#' + tempWidgetID).fadeOut('slow', function() {
                                    Ext.getCmp(tempWidgetID).destroy();
                                    tempConfigObj['setDisabled']  = false;
                                    Ext.getCmp('widgetslist').add(tempConfigObj);
                                });
                                $('#' + btn.id).find('span[class="x-btn-icon icon-checked icon-unchecked"]').removeClass('icon-unchecked');
                            }
                        }
                    },
                    listeners: {
                        render: function(btn) {
                            if( me.config.isChart === 'Y' ) {
                                $('#cppswidget').show();
                                $('#cppslimitstbl').hide();
                            }
                            else {
                                $('#cppswidget').hide();
                                $('#cppslimitstbl').show();
                            }
                        }
                    }
                };
            }
        }
        this.id = me.config.widgetID + '-chartContainer';
        Ext.applyIf(me, {
            id: me.config.id+'-chartContainer',
            chart: null,
            items: [
                {
                    xtype: 'panel',
                    title: me.config.widgetName,
                    id: me.config.widgetID,
                    html: '<div><div id="" class="lastupdatetimecontainer"><span class="bold">'+TC.LAST_UPDATED+':</span>&nbsp;<span id="cplastupdatetimemin"> </span></div><div id="currencytype"  class="currencytype hide">'+TC.CURRENCY_TYPE_USD+'</div><div id="cppswidget"></div><div id="piechartdrill"></div></div><div><div id="cppslimitstbl" style="display: none; width: 300px;"></div><div id="cppslimitstbldrill" style="display: none;width: 300px;"></div></div>',
                    height: 340, 
                    cls: 'widgetpanel',
                    tools: childItems
                }
            ],
            listeners:{
                render:{
                    fn:function(){
                        me.tbl = createCPPSDataGrid(me.config.widgetID);
                        if( me.config.isChart === 'Y' ) {
                            $('#cppswidget').show();
                            $('#cppslimitstbl').hide();
                        }
                        else {
                            $('#cppswidget').hide();
                            $('#currencytype').show();
                            $('#cppslimitstbl').show();
                        }   
                    }
                }
            }
        });
        me.callParent(arguments);
    },
    getChart: function() {
        return this.chart;
    }
});
createCPPSDataGrid = function(widgetId,id, cid) {
    alert("Create CPPS Grid");
    TU.getCPPSData(renderGridData, id, cid,widgetId);
};
reloadDataGridCPPS = function(widgetId,id, cid) {
    alert("Reload CPPS Grid");
    TU.reloadgetCPPSData(renderGridData, id, cid,widgetId);
};
var widgetChart01;
var cppsGird;
var isExpandMode = false;
var piechartdrillID = 'piechartdrill';
var cppslimitstbldrillID = 'cppslimitstbldrill';
renderGridData = function(gridData, chartData, id, cid,widgetId,lastUpdated) {
    FusionCharts.setCurrentRenderer('javascript');
    widgetChart01 = new FusionCharts( "FusionCharts_XT_Evaluation/Charts/ScrollColumn2D.swf", "chartID01", "100%", "300", "0", "1" );
    widgetChart01.setJSONData(chartData);
    TU.widgetChartArray[widgetId] = new Array();
    TU.widgetChartArray[widgetId][0] = 'cppswidget';
    TU.widgetChartArray[widgetId][1] = widgetChart01;
    //console.log('JSON.stringify: ' + JSON.stringify(chartData));
    removeViewsCPPS();
    if( typeof id === 'undefined' ) {
        var viewsArray = new Array();
        viewsArray.push('cppswidget');
        viewsArray.push('cppslimitstbl');
        TU.removeChildElements(viewsArray);
        widgetChart01.render('cppswidget');
        $('#cplastupdatetimemin').text(lastUpdated);
    }
    else {
        widgetChart01.render(cid);
        $('#cplastupdatetime').text(lastUpdated);
    }

    FusionCharts("chartID01").configureLink({
        width : '100%',
        height: '100%',
        id: 'linked-chart-cpps',                        
        overlayButton: { show : false }
    }, 0);  
    //var that = this;
    widgetChart01.addEventListener ("DrawComplete", function() {
        TU.appsLoadingArr[widgetId] = 'Y';
    });
    //FusionCharts("chartID01").addEventListener ("DrawComplete" , myChartListener );

    var cppsGirdStore = Ext.create('Ext.data.Store', {
        storeId:'CPPSSimpsonsStore',
        //fields:['slNo', 'counterpartyName', 'limitsDefined', 'limitsUtilized', 'limitsAvailable', 'limitsBreached'],
        fields:['counterpartyName', 'limitsDefined', 'limitsUtilized', 'limitsAvailable', 'limitsBreached'],
        data: {
            'items': gridData
        },
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });

    cppsGird = Ext.create('Ext.grid.Panel', {
        store: Ext.data.StoreManager.lookup('CPPSSimpsonsStore'),
        id:'cppsGridID',
        columns: [
            //{ text: 'Sl. No',  dataIndex: 'slNo', height: 20, flex: 5/100 },
            { text: 'Counterparty', dataIndex: 'counterpartyName', height: 20, flex: 10/100 },
            { text: 'Limits Prescribed', dataIndex: 'limitsDefined', height: 20, flex: 20/100, renderer: TU.replaceZeroWithHiphens },
            { text: 'Limits Utilised', dataIndex: 'limitsUtilized', height: 20, flex: 20/100, renderer: TU.replaceZeroWithHiphens },
            { text: 'Limits Available', dataIndex: 'limitsAvailable', height: 20, flex: 20/100, renderer: TU.replaceZeroWithHiphens },
            { text: 'Limits Breached', dataIndex: 'limitsBreached', height: 20, flex: 20/100, renderer: TU.replaceZeroWithHiphens }
        ],
        height: (typeof id === 'undefined'?313:380),
        width: (typeof id === 'undefined'?301:949),
        renderTo: (typeof id === 'undefined'?'cppslimitstbl':id)
    });

},

function createFilterForCPPS(widgetId) {
    var filterValuesArray = TU.getFilterListForCPPresettlementLimits(widgetId);
    var tempArray = Array();
    if (typeof filterValuesArray !== 'undefined' && filterValuesArray.length > 0) {
        for (var f =0; f < filterValuesArray.length; f++) {
            if(filterValuesArray[f].selected === 'Y') {
                tempArray.push('<option selected value="'+filterValuesArray[f].slNo+'">'+filterValuesArray[f].counterpartyName+'</option>');
            }
            else {
                tempArray.push('<option value="'+filterValuesArray[f].slNo+'">'+filterValuesArray[f].counterpartyName+'</option>');
            }
        }
    }
    var t = tempArray.join('');
    $('.filter-wrapper').remove();
    $('#filterInput').remove();
    $('.ui-pop-window .x-window-header').append('<div class="filter-wrapper">' + '<select id="filterInput" class="filterInputPop" multiple="multiple" onChange= "javascript: applyFilterForCP(\''+widgetId+'\','+true+');"> '+t+'</select>' + '</div>');
    // PSI_140214 starts
    $("#filterInput").dropdownchecklist({
        //onItemClick: function(checkbox, selector){
        onItemClick: function(event){
            var isChecked = $(event.parent()).children()[0].checked;
            if( isChecked ) {
                var temp = $('.ui-dropdownchecklist-dropcontainer').children();
                $(temp[0]).before(event.parent());
            }
            else {
                $('.ui-dropdownchecklist-dropcontainer').append(event.parent());
            }
             var values = "";
            var newText = 'Checkbox ID = '+checkbox.attr('id')+'&lt;br/>&lt;br/>';
            for( i = 0; i < selector.options.length; i++ ){
                newText += 'Option i = ' +i+ ' || value = ' +selector.options[i].value+ ' || checked = ' +selector.options[i].selected+ '&lt;br/>&lt;br/>';
                if (selector.options[i].selected && (selector.options[i].value != "")){
                    if ( values != "" )
                        values += ";";
                    values += selector.options[i].value;
                }
            }
            newText += 'Selector Value = '+values; 
        }
    }); 
    // PSI_140214 ends
    $('.ui-dropdownchecklist-dropcontainer-wrapper').prepend('<div class="filterbtns"><a href="javascript:void(0)" onclick="onCPPSSaveBtnClick(\''+widgetId+'\')" class="filter-save">Save</a><a href="javascript:void(0)" onclick="onCPPSResetBtnClick(\''+widgetId+'\')" class="filter-reset">Reset</a></div>');
 },

function printCPContent() {
    var DocumentContainer = document.getElementById('printWidget');
    var WindowObject = window.open("", "PrintWindow","width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
    WindowObject.document.writeln(DocumentContainer.innerHTML);
    WindowObject.document.close();
    WindowObject.focus();
    WindowObject.print();
    WindowObject.close();
},

function onCPPSSaveBtnClick(widgetId) {
    //getSelectedValuesFromFilter(widgetId);
    TU.sendCPFilterData(getSelectedValuesFromFilterCP(widgetId));
},
function onCPPSResetBtnClick(widgetId){
    TU.resetWidgetDataForCPPS(widgetId);
    var widgetData = TU.widgetsLevelPrefData[widgetId].data;
    if(typeof widgetData!== 'undefined' && widgetData !== null && widgetData.length > 0) {
        var sortedData = TU.sortCPPSData(widgetData);
        TU.widgetsLevelPrefData[widgetId].data = sortedData;
        var gridData = TU.createJSONStructureForCPPSGrid(sortedData);
        var chartData = TU.getCPPSChartData(sortedData);
        loadCPPSChartData(chartData,'cpps_widgetfullscreen'); 
        loadCPPSGridData(gridData);
        createFilterForCPPS(widgetId);
    }
},
function getSelectedValuesFromFilterCP(widgetId) {
    var selected = $("#filterInput").val();
    var JSONData = TU.widgetsLevelPrefData[widgetId];
    var JSONDataRepete = JSONData.data;
    var tempArray = Array();
    var JSONDataLength = JSONDataRepete.length;
    if(typeof selected !== 'undefined' && selected !== null) {
        //var selectedLength = selected.length;
        for(var d = 0; d < JSONDataLength; d++){
            var index = selected.indexOf(JSONDataRepete[d].slNo);
            if(index !== -1) {
                JSONDataRepete[d].selected = "Y";
                tempArray.push(JSONDataRepete[d]);
                //JSONData.data[d].selected = "Y";
            }
            else {
                JSONDataRepete[d].selected = "N";
                tempArray.push(JSONDataRepete[d]);
            }
        }
    }
    else {
        for(var d = 0; d < JSONDataLength; d++) {
            JSONDataRepete[d].selected = "N";
            tempArray.push(JSONDataRepete[d]);
        }
    }
    return tempArray;
};
function applyFilterForCP(widgetId,isExpandMode) {
    var updatedData = getSelectedValuesFromFilterCP(widgetId);
    var widgetData = updatedData;
    if(typeof widgetData!== 'undefined' && widgetData !== null && widgetData.length > 0) {
        var sortedData = TU.sortCPPSData(widgetData);
        var mainArray = Array();
        for(var d = 0; d < sortedData.length; d++){
            var tempArray = {"counterpartyCode": sortedData[d].counterpartyCode,"counterpartyName": sortedData[d].counterpartyName,"limitsAvailable": sortedData[d].limitsAvailable,"limitsBreached": sortedData[d].limitsBreached,"limitsDefined":sortedData[d].limitsDefined,"limitsUtilized": sortedData[d].limitsUtilized,"position": sortedData[d].position,"slNo": sortedData[d].slNo,"selected": sortedData[d].selected};
            mainArray.push(tempArray);  
            delete tempArray;
        }
        TU.widgetsLevelPrefData[widgetId].data = mainArray;
        var gridData = TU.createJSONStructureForCPPSGrid(sortedData);
        var chartData = TU.getCPPSChartData(sortedData);
        loadCPPSGridData(gridData);
        loadCPPSChartData(chartData,'cpps_widgetfullscreen'); 
    }
};
function loadCPPSChartData(chartData,renderTo) {
    if(chartData!== '' && typeof chartData !== 'undefined' && renderTo !== '' && typeof renderTo !== 'undefined' && chartData !== '' && typeof chartData !== 'undefined') {
        widgetChart01.setJSONData(chartData);
        widgetChart01.render(renderTo);
        FusionCharts("chartID01").configureLink({
            width : '100%',
            height: '100%',
            id: 'linked-chart-cpps_cp',                     
            overlayButton: { show : false }
        }, 0);
    }
};
function loadCPPSGridData(gridData) {
    var store = Ext.data.StoreManager.lookup('CPSimpsonsStore');
    store.loadData(gridData);
    Ext.getCmp('cppsGridID').getView().refresh();
};
var isDrillDownForCPPS = false;
function checkForDrillDownOptionsForCPPS(cpCode) {
    if(isDrillDownForCPPS) {
        showDrillDownForCPPS(cpCode);
    }
};

function showDrillDownForCPPS(cpCode) {
    TU.getDWCPPSUtilizationData(renderDrillDownForCPPS,cpCode);
};
var widgetPieChart;
function renderDrillDownForCPPS(gridData,chartData,cpCode,lastUpdated) {
    if (isExpandMode) {
        $('#cpps_widgetfullscreen').hide();
        //$('#export_expand').hide();
        $('#cpps_table_expand').hide();
        $('#cpps_reload_expand').hide();
        //$('#print_expand').hide();
        $('#filterInput').remove();
        $('#cpps_drilldownback_expand').show();
        $('#cpps_drilldowntable_expand').show();
        changeCPPSWidgetTitle(true,'WID19-window');
        $('#cplastupdatetime').text(lastUpdated);
    }
    else {
        $('#cpps_expand').hide();
        $('#cpps_table').hide();
        $('#cpps_reload').hide();
        $('#cppswidget').hide();
        $('#cpps_drilldowntable').show();
        $('#cpps_drilldownback').show();    
        changeCPPSWidgetTitle(true,'WID19');
    }

    $('#'+piechartdrillID).children().remove();
    $('#'+cppslimitstbldrillID).children().remove();
    widgetPieChart = new FusionCharts( "FusionCharts_XT_Evaluation/Charts/Pie2D.swf", "cpps_DWCPUtilization", "100%", "300", "0", "1" );
    loadDrillDownData(chartData);
    var cppsDrillDownGridStore = Ext.create('Ext.data.Store', {
        storeId:'DWCPPSUtilSimpsonsStore',
        //fields:['slNo', 'dealerName', 'dealerUtilization'],
        fields:['dealerName', 'dealerUtilization'],
        data: {
            'items': gridData
        },
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });

    var cppsGridDrillDown = Ext.create('Ext.grid.Panel', {
        store: Ext.data.StoreManager.lookup('DWCPPSUtilSimpsonsStore'),
        id:'dwcppsUtiilGridID',
        columns: [
            //{ text: 'Sl. No',  dataIndex: 'slNo', height: 20, flex: 5/100 },
            { text: 'Dealer', dataIndex: 'dealerName', height: 20, flex: 10/100 },
            { text: 'Utilisation', dataIndex: 'dealerUtilization', height: 20, flex: 20/100, renderer: TU.replaceZeroWithHiphens}
        ],
        height: (cppslimitstbldrillID === 'cppslimitstbldrill'?313:380),
        width: (cppslimitstbldrillID === 'cppslimitstbldrill'?301:949),
        renderTo: cppslimitstbldrillID
    });

};

function loadDrillDownData(chartData) {
    widgetPieChart.setJSONData(chartData);
    widgetPieChart.render(piechartdrillID);
    $('#'+piechartdrillID).show();
    $('#'+cppslimitstbldrillID).hide();
    FusionCharts("cpps_DWCPUtilization").configureLink({
        width : '100%',
        height: '100%',
        id: 'linked-chart-cpps-dw',
        overlayButton: { show : false }
    });
};
function removeViewsCPPS(){
    var viewsArray = new Array();
    viewsArray.push('cpps_widgetfullscreen');
    viewsArray.push('cpps_datagridfullscreen');
    TU.removeChildElements(viewsArray);
};

function changeCPPSWidgetTitle(isDrilldown,id) {
    if(isDrilldown) {
        Ext.getCmp(id).setTitle('Dealer Wise PS Counterparty Utilisation');
    }
    else {
        Ext.getCmp(id).setTitle('PSCounterparty Limits');
    }
};
function createOptionsForDropDown(filterValuesArray) {
    var tempArray = Array();
    for (var f =0; f < filterValuesArray.length; f++) {
        if(filterValuesArray[f].selected === 'Y') {
            tempArray.push('<option selected value="'+filterValuesArray[f].slNo+'">'+filterValuesArray[f].counterpartyName+'</option>');
        }
        else {
            tempArray.push('<option value="'+filterValuesArray[f].slNo+'">'+filterValuesArray[f].counterpartyName+'</option>');
        }
    }
    return tempArray;
};

0 个答案:

没有答案