It will be hard for us to figure out for you the problem if you do not include all the components.
I assume that the js is a library that runs and configures the Model. There are probably many that do this..
You need to include this and any other relevant info/component . We are not always able to guess how and what you are doing and do not always have time to recreate projects from scratch. Also as good as some of us are at working out solutions, does not mean that we are familiar with everything that is out there. So including all the info and a working example will help use look and figure out whats going on. We are quick learners..