View Full Version : [FIXED] Models with "idProperty" makes "Uncaught Error: Cannot load phantom model " error

3 Jun 2014, 3:15 AM
If I set idProperty for a Model , I get "Uncaught Error: Cannot load phantom model " error. The fiddle is here (check the console after run) :


If I remove or comment the "IdProperty" , everything would be ok!

3 Jun 2014, 3:51 AM
Thanks for the report! I have opened a bug in our bug tracker.

4 Jun 2014, 4:25 AM

What can do as a workaround for this? I am making calls to getById which is failing if I remove the idProperty.


4 Jun 2014, 6:58 AM

To fix this you need to edit packages/sencha-core/src/data/Model.js and replace:

load: function(id, options, session) {
var rec = new this({
id: id
}, session);
return rec;

with this:

load: function(id, options, session) {
var rec = this.createWithId(id, options, session);
return rec;

I have modified my local version here - is this the recommended way to do it?


4 Jun 2014, 11:12 AM
Evan - this seems like a show-stopper...

will we get patch for this?

30 Jun 2014, 4:30 AM
I've updated my ext source code, but it's not completly solved with just that change. (Hopefully 5.0.1 does something more..)

I my case I have a model with idProperty set to Id (not id) and doing a
ModelName.load('currenUser',function()... )

After the codechange I do get the correct change to the server, but when the result is returned I get a new error: "Invalid record id returned for currentUser@ModelName"

30 Jun 2014, 11:39 AM
Can someone help me? this is my model

Ext.define('portalservicos.model.ConfiguracaoCartorio', { extend: 'Ext.data.Model',
{name: 'cdConfiguracao', type: 'integer'},
{name: 'nrCepCartorio', type: 'string'},
{name: 'nmBancoDeposito', type: 'string'},
{name: 'nrContaDeposito', type: 'string'},
{name: 'nrAgenciaDeposito', type: 'string'},
{name: 'nmRazaoSocialDeposito', type: 'string'},
{name: 'nrCnpjDeposito', type: 'string'},
{name: 'nmEmailCartorio', type: 'string'}
proxy : {
type: 'rest',
url : 'localhost:8080/portalservicosback/configuracao'

i don't have idProperty but when i try to load i got:

var ddd = Ext.create('model.ConfiguracaoCartorio')undefinedddd.load(1,{})[E] Ext.data.Model.load(): Cannot load phantom model Util.js?_dc=1404157018162:692Object Util.js?_dc=1404157018162:698console.trace() Util.js?_dc=1404157018162:704logUtil.js?_dc=1404157018162:704Ext.apply.raiseError.js?_dc=1404157018162:186Ext.define.loadModel.js?_dc=1404157018162:1705(anonymous function)VM6033:2InjectedScript._evaluateOnVM5936:668InjectedScript._evaluateAndWrapVM5936:607InjectedScript.evaluateVM5936:519Ext.data.Model.load(): Cannot load phantom model

1 Jul 2014, 8:40 AM
I'm having the same issue, and since all of my models rely on idProperty, it's completely blocking me from upgrading to Ext 5. When will Ext 5.0.1 be available for download?

I figured some bugs would be found in Ext 5, especially with new features, but not with something like this.

2 Jul 2014, 11:56 PM
Thank you for fixing, it is really important issue.
But could you say, how to download 5.0.1 version, to upgrade from, maybe some command of Sencha CMD?

3 Jul 2014, 10:29 PM
5.0.1 is not complete yet, but with support subscription you can download the nightly from the support page.

I've been testing 5.0.1 now, but there is still an issue where whenever I create a new record the model is populated with a generated Id, and the server side (at least mine) get confused since the server expect to generate the Id by itself. Also the user is confused, since I'm showing the Id in the edit/create form, and since populated by the model record an Id is shown to the user even before it's first save :(

28 Jul 2014, 11:28 AM
Here's my override hotfix if anyone else can use it: https://github.com/JarvusInnovations/ext-library/blob/master/Jarvus/ext/patch/data/LoadWithId.js

* Fixes error "cannot load phantom model" when calling Model.load(id)
* See http://www.sencha.com/forum/showthread.php?286388
Ext.define('Jarvus.ext.patch.data.LoadWithId', {
override: 'Ext.data.Model',

inheritableStatics: {
load: function(id, options, session) {
var rec = this.createWithId(id, options, session);
return rec;

}, function() {
if (!Ext.getVersion().match('')) {
console.warn('This patch has not been tested with this version of ExtJS');

17 Sep 2014, 2:24 PM
I'm using extj "" but i still with this error:

when i run : Ext.versions.core.version i got the version "5.0.0"

can this be a problem??

this is my model..:


extend: 'Ext.data.Model',
fields :[
{name : 'cdUsuario', type : 'int'},
{name : 'nmUsuario', type: 'string'},
{name : 'nmEmail', type: 'string'},
{name : 'nrCpf', type: 'string'},
{name : 'dsSenha', type: 'string'},
{name : 'dsLembreteSenha', type: 'string'},
{name : 'nrNivelAcesso', type: 'number'},
{name : 'nrCep', type: 'string'},
{name : 'nmTipoLogradouro', type: 'string'},
{name : 'nmLogradouro', type: 'string'},
{name : 'nrLogradouro', type: 'string'},
{name : 'nmBairro', type: 'string'},
{name : 'nmComplementoLogradouro', type: 'string'},
{name : 'nmCidade', type: 'string'},
{name : 'sgEstado', type: 'string'},
{name : 'nrTelefoneContato', type: 'string'}
proxy: {
type: 'rest',
url : '/usuario'
idProperty : 'cdUsuario'