ExtJS组件已加载但未在屏幕上显示

时间:2013-07-25 13:03:22

标签: javascript extjs extjs4.1

我正在使用ExtJs 4.1.1 在我的屏幕上,我有多个组件通过AJAX调用加载。 这些组件应显示在页面加载上。 但我得到了一个空白屏幕。

我正在使用ExtJS标签来显示屏幕。 以下是代码:

JSP:

<body>
<div id="divQueryBuilder"/>
</body>

JS

Ext.define('Ext.ux.window.VisualSQLQueryBuilder', { 
extend: 'Ext.panel.Panel',
id: 'VisualSQLQueryBuilderId',
renderTo: Ext.Element.get('divQueryBuilder'),
height: "100%",
width: "100%",
layout: {
    type: 'border'
},
/*title: 'Visual SQL Query Builder',*/
items: [        
    {
        xtype: 'panel',
        title: 'Table Panel',
        width: "23%",
        height: 500,
        autoScroll: true,
        collapsible: true,
        region: 'west',
        layout: {
            type: 'vbox',
            align: 'center'
        },
        split: true,
        items:[
            {
                xtype: 'toolbar',
                border: 1,
                dock: 'top',
                width: '100%',
                items: [{
                        xtype: 'textfield',
                        id: 'txtSearchTables',
                        fieldLabel: 'Search Tables:',
                        allowBlank: true,
                        listeners: {
                            change: function( triggerField, newValue, oldValue, eOpts ){
                                Ext.getCmp('SQLTableTree').filterByText(newValue);
                        }
                    }
                },{
                    xtype : 'button',
                    id : 'clearSearchText',
                    icon : 'images/remove-16x16.gif',
                    tooltip : 'Clear search',
                    handler : function() {
                        Ext.getCmp('txtSearchTables').setValue('');
                        Ext.getCmp('txtSearchTables').focus();
                    }
                }]                  
            },
            {
                xtype: 'sqltabletree',
                flex: 3,
                width: "100%",
                split: true,
                title: 'Tables',
                collapsible: true,
                rootVisible : false,
                region : 'north'
            },
            {
                xtype: 'sqlvirtualtabletree',
                flex: 1,
                width: "100%",
                split: true,
                title: 'Virtual Tables',
                collapsible: true,
                rootVisible : false,
                region : 'south'
            }
       ]
    },
    { 
        xtype: 'panel',
        width: "77%",
        height: '100%',
        layout: 'border',
        region: 'center',
        items: [
            //queryOutPutWindow,                
            {
                xtype: 'panel',
                border: false,
                height: '100%',
                layout: 'border',
                region: 'north',
                split: true,
                items: [
                    {
                        xtype: 'sqltablepanel',
                        border: false,
                        region: 'center',
                        split: true,
                        layout: 'fit'
                    },
                    {
                        xtype: 'sqlfieldsgrid',
                        border: false,
                        height: '30%',
                        region: 'south',
                        split: true,
                        hidden: true
                    },
                    {
                        xtype: 'sqlattributegrid',
                        border: false,
                        region: 'south',
                        split: true,
                        hidden: true
                    },
                    {
                        xtype: 'sqlcriteriagrid',
                        border: false,
                        region: 'south',
                        split: true,
                        hidden: true
                    }
                ]
            }
        ]
    },
    SQLResultTabPanel
],
initComponent: function () {

    // create user extension namespace ux.vqbuilder
    Ext.namespace('ux.vqbuilder');

    // disable gutter (linenumbers) and toolbar for SyntaxHighlighter
    SyntaxHighlighter.defaults['gutter'] = false;
    SyntaxHighlighter.defaults['toolbar'] = false;

    ux.vqbuilder.connections = [];

    ux.vqbuilder.sqlSelect = Ext.create('Ext.ux.window.visualsqlquerybuilder.SQLSelect');

    // add toolbar to the dockedItems
    this.dockedItems = [
        {
            xtype: 'toolbar',
            border: 1,
            dock: 'top',
            items: [
                {
                    xtype: 'button',
                    text: 'Refresh',
                    id: 'btnTreeRefresh',
                    icon: 'images/arrow_refresh.png',
                    handler: function () {
                        Ext.data.StoreManager.lookup('treeStore').load();
                        Ext.data.StoreManager.lookup('virtualTreeStore').load();
                        queryStore.load();
                    }
                },
                '-',
                queryCombo,
                {xtype: 'button',
                    text: 'Load',
                    id: 'btnLoad',
                    icon: "images/database_go.png", 
                    visible: false,
                    handler: function () {
                        ux.vqbuilder.sqlSelect.loadQueryView();
                    }
                },
                '-',
                '->',
                {
                    xtype: 'splitbutton',
                    text : 'New',
                    id: 'btnNew',
                    icon: "images/application_add.png",
                    menu : {
                        items: [{
                            text: 'Online Report',
                            icon: "images/online.gif",
                            handler: function () {
                                ux.vqbuilder.sqlSelect.newQuery();
                                queryState = 1;
                                sqlQueryType = 1;
                                operationType = 1;
                                ux.vqbuilder.sqlSelect.newQueryFormSettings(queryState, sqlQueryType, 'New Online Report', null, operationType);
                            }
                        }, {
                            text: 'Offline Report',
                            icon: "images/offline.gif",
                            handler: function () {
                                ux.vqbuilder.sqlSelect.newQuery();
                                queryState = 2;
                                sqlQueryType = 1;
                                operationType = 1;
                                ux.vqbuilder.sqlSelect.newQueryFormSettings(queryState, sqlQueryType, 'New Offline Report', null, operationType);
                            }
                        }]
                    },
                    handler: function () {
                        ux.vqbuilder.sqlSelect.newQuery();
                        newQueryForm.show();
                    }
                },
                {
                    xtype: 'button',
                    text: 'Edit',
                    id: 'btnEdit',
                    icon: "images/application_edit.png",
                    handler: function () {
                        ux.vqbuilder.sqlSelect.editQuery();
                    }
                },
                {
                    xtype: 'button',
                    text: 'Delete',
                    id: 'btnDelete',
                    icon: "images/application_delete.png",
                    handler: function () {
                        ux.vqbuilder.sqlSelect.deleteQuery();
                    }
                },
                '-',
                {
                    text: "Save",
                    id: 'btnSave',
                    icon: "images/icon-save.gif",
                    handler: function () {
                        debugger;
                        var finalQuery=Ext.getCmp("manualQueryEdit").getValue();
                        if(ux.vqbuilder.sqlSelect.fields.getCount() > 0 || operationType == 4 ||finalQuery.length>0){
                            loadMask.show();
                            ux.vqbuilder.sqlSelect.saveQuery();
                            loadMask.hide();
                        } else {

                                ShowExtError('No Column/Table Select.');
                        }
                    }
                },
                {
                    text: "Cancel",
                    id: 'btnCancel',
                    icon: "images/cross.png",
                    /*icon: "images/cancel.gif",*/
                    handler: function () {
                        Ext.getCmp('newQueryProperties').hide();
                        ux.vqbuilder.sqlSelect.setQueryButtons(0);
                        sqlOutput = '';
                    }
                },
                '-',
                {
                    xtype: 'button',
                    text: "Run",
                    id: 'btnRun',
                    icon: "images/run.png",
                    handler: function () { 
                        var finalQuery=Ext.getCmp("manualQueryEdit").getValue();

                        if(ux.vqbuilder.sqlSelect.fields.getCount() > 0 || operationType == 4 ||finalQuery.length>0)
                            ux.vqbuilder.sqlSelect.ShowQuery();
                        else {


                                ShowExtError('No Column/Table Select.');
                        }
                    }

                }
            ]
        },
        {
            xtype: 'toolbar',
            dock: 'top',
            id: 'newQueryProperties',
            hidden: true,
            items: [
                '->',
                {
                    xtype: 'label',
                    style: 'font-weight:bold;',
                    text: 'Query State: '

                },
                {
                    xtype: 'label',
                    id: 'newQueryStateId',
                    text: 'Query State'
                },
                '-',
                {
                    xtype: 'label',
                    style: 'font-weight:bold;',
                    text: 'Query Type: '

                },
                {
                    xtype: 'label',
                    id: 'newQueryTypeId',
                    text: 'Query Type'
                },
                '-',
                {
                    xtype: 'label',
                    hidden: true,
                    id: 'newQueryOpTypeLblId',
                    style: 'font-weight:bold;',
                    text: ' Operation Type: '

                },
                {
                    xtype: 'label',
                    hidden: true,
                    id: 'newQueryOpTypeId',
                    text: 'Operation Type'
                },
                {
                    xtype: 'tbseparator',
                    id: 'OpTypeSeparator'
                },
                {
                    xtype: 'label',
                    hidden: true,
                    id: 'newQueryAppLblId',
                    style: 'font-weight:bold;',
                    text: ' Application: '

                },
                {
                    xtype: 'label',
                    hidden: true,
                    id: 'newQueryAppId',
                    text: 'Application'
                },
                {
                    xtype: 'tbseparator',
                    id: 'AppSeparator'
                },
                {
                    xtype: 'label',
                    style: 'font-weight:bold;',
                    text: ' Query Name: '
                },
                {
                    xtype: 'label',
                    id: 'newQueryNameId',
                    text: 'Query Name'
                },
                '-'
            ]
        }

    ];
    this.callParent(arguments);
    queryCombo.focus();
    ux.vqbuilder.sqlSelect.setQueryButtons(0);
}

现在奇怪的是我在Chrome开发人员中没有遇到任何错误。 此外,当我检查chrome developer中的网络选项卡时,我可以看到所有商店的加载完全正常。

请在这里建议可能出现的问题!!!

1 个答案:

答案 0 :(得分:0)

您可以尝试为外部面板提供specific width height,而不是100%。