【发布时间】:2015-03-19 15:33:30
【问题描述】:
我从服务器获取json 数据,例如1,User,2,Courses,3,Organization如下图所示的文本框(选项卡)。
,
我在alert('entities from the 466 line '+e); 中遇到了类似typeerror undefined is not a function 的异常
谁能帮帮我?
AUI().ready('aui-textboxlist', function(A) {
try {
alert('before calling selectEntities()');
var entities = selectEntities();
console.log(" entities "+entities);
alert("entities from the server "+entities);
entitiesBoxList = new A.TextboxList({
contentBox: '#<portlet:namespace />entitiesDiv',
dataSource: entities,
matchKey: 'name',
schema: {
resultFields: ['id', 'name']
},
queryMatchContains:true,
queryDelimiter : ',',
after: {
render: function() {
try{
var instance_ = this;
var index = 0;
this.entries.insert(index, entry);
}catch (e) {
alert("exception raised at 461 line"+e);
}
}
}
}).render();
} catch(e){
alert('entities from the 466 line '+e);
}
}
【问题讨论】:
-
如果你用 this.entries 这样注释掉这行:
// this.entries.insert(index, entry);,它还会发生吗?我能想到的另一件事是.render()调用导致了这种情况。您的缩进非常奇怪,因此很难解释脚本,如何花一些时间重构它以使其更具可读性?您可能会在该过程中发现错误。
标签: javascript jquery liferay liferay-6 liferay-aui