我使用ExtJS 5.0.1创建了一个简单的面板,但不起作用。每次我收到错误SyntaxError: expected expression, got '}'
var anchura = windowWidth;
anchura *= 0.970;
anchura += 1;
var altura = windowHeight;
altura *= 0.98;
panel = new Ext.panel.Panel({
id:'ventana',
autoScroll:true,
height: altura,
width: anchura,
title: ' <bean:message key="breadcrumbs.gestionInventarios.consultaMultiple" />',
iconCls:'vDependencias',
layout: 'border',
closable: false,
renderTo: 'contenedor',
resizable: false,
items: ['algo','otro algo'],
frame: true
});
var panel= Ext.create('Ext.panel.Panel', {
id:'ventana',
autoScroll:true,
height: altura,
width: anchura,
title: ' <bean:message key="breadcrumbs.gestionInventarios.consultaMultiple" />',
iconCls:'vDependencias',
layout: 'border',
closable: false,
renderTo: 'contenedor',
resizable: false,
items: [{some type},{some type}],
frame: true
});
由于您使用默认面板,因此您无法正确定义项目。请参阅此处的文档:http://docs.sencha.com/extjs/5.0/5.0/5.0.1-apidocs/#!/expi/ext.grid.panel-cfg-items
项目应为
单个项目或要添加到此的儿童组件数组 容器
。组件是对象而不是字符串。您不能将一系列字符串传递给项目。
示例:
items:[
{xtype:'button'},
{xtype:'textfield'}
]
否则,您的构造中没有错。
尝试这样的东西,
panel = new Ext.panel.Panel({
id:'ventana',
autoScroll:true,
height: altura,
width: anchura,
title: ' <bean:message key="breadcrumbs.gestionInventarios.consultaMultiple" />',
iconCls:'vDependencias',
layout: 'border',
closable: false,
renderTo: 'contenedor',
resizable: false,
items: [variabl1,variabl2 ],
frame: true
});
这可能是您问题的根本原因。
另外,请确保声明了altura
和anchura
变量,并且仅针对此面板出现错误。!