Created
August 2, 2013 23:15
-
-
Save cmilfont/6144216 to your computer and use it in GitHub Desktop.
Test before and after overriding in https://gist.github.com/cmilfont/6142566
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('Atlas.model.Chamado', { | |
extend: 'Ext.data.Model', | |
fields: [ | |
'id', | |
'titulo', | |
{ name: "status", persist: false, mapping: 'status.nome'}, | |
], | |
belongsTo: [ | |
{model: 'Atlas.model.Contrato', associationKey: 'contrato', getterName: 'contrato'} | |
], | |
proxy: { | |
type: "rest", | |
url: "/chamados" | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('Atlas.model.Contrato', { | |
extend: "Ext.data.Model", | |
fields: [ | |
'id', | |
'cliente_id', | |
{ name: "cliente", mapping: 'cliente.nome', persist: false} | |
], | |
belongsTo: [ | |
{model: 'Atlas.model.Cliente', associationKey: 'cliente', getterName: 'cliente'} | |
], | |
proxy: { | |
type: "rest", | |
url: "/contratos" | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chamado = Ext.create("Atlas.model.Chamado", { | |
titulo: "Atendimento por Telefone", | |
status: { | |
id: 1, | |
nome: "Pendente" | |
} | |
contrato: { | |
id: 5609, | |
cliente: { | |
id: 1034, | |
nome: "Grupo Fortes" | |
} | |
} | |
}); | |
chamado.contrato(); //is Null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment