ASR
ASR

Reputation: 3549

typeerror undefined is not a function liferay

I am getting the json data from the server like 1,User,2,Courses,3,Organization correctly, this data I am storing in a variable entities, now I am adding this json data for text field for auto complete and then allow multiple values for the text box(tabs) like in the below image.

enter image description here,

I am getting the exception like typeerror undefined is not a function in the alert('entities from the 466 line '+e);

Can any one help me?

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);
}

}

Upvotes: 0

Views: 1301

Answers (2)

ASR
ASR

Reputation: 3549

Actually the above code works fine in Liferay-6.06, I am trying to migrate it to Liferay-6.2, so the AUI version in 6.06 is not works in 6.2:

    AUI().ready('aui-textboxlist-deprecated', function (A) {

        // code that uses A.TextboxList goes here
    }); 

the code is for 6.2. For 6.1, we have to use aui-textboxlist instead of aui-textboxlist-deprecated.

Upvotes: 0

Tyler Davis
Tyler Davis

Reputation: 913

You said it is on the line with:

alert('entities from the 466 line '+e);

Then it's either saying your alert() is not a function (unlikely) or something in your 'e' value. Since you said it contains JSON data, maybe it's because you aren't parsing the data correctly?

Possibly better: I noticed you have a function called selectEntities() on line 3. Maybe it's referring to that line and you have a binding issue.

Upvotes: 1

Related Questions