我正在使用 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 开发人员中检查网络选项卡时,我可以看到所有商店都加载得很好。
请提出这里可能是什么问题!!!