Skip to content

Index issue in JS #22

@lmouline

Description

@lmouline

Take my favorite example, a Parking :

class kmf.test.Park {
    att name : String with index
}

I have a simple Java code which create a Park, save the model and open a websocket on the port 8083.

I have also a simple html file that contains the following JS script:

model.lookup(0,0,1,function(park){
            console.log(park.toJSON());

            model.findAll(kmf.test.meta.MetaPark.getInstance(),0,0,function(kPark){
                console.log(kPark[0].toJSON());
            })
        });

As output I have :

{"universe":0,"time":0,"uuid":1,"data":{"name":"Parkl"}}
Uncaught TypeError: Cannot read property 'index' of null

This exception occurs on this line of my "JS API" file:

ArrayLongLongMap.prototype.init = function (payload, metaModel, metaClassIndex) {
[...]
if (payload.charAt(cursor) == ',') {
      this._metaClassIndex = metaModel.metaClassByName(payload.substring(initPos, cursor)).index();
      cursor++;
      initPos = cursor;
}
[...]

If I remember correctly, I had a similar error in Java when I tried to access an indexed class without index attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions