During the initial application load, I am seeing the model proxies send their requests and the stores load up. I do not see anything happen, when I call that attachments function.
On strange thing, I do not have a method called 'attachments()', I end up with a method named "record.programProgramsMyAppModelAttachments()". This is the method I am trying to call, and it looks like it is an attachment store, but the data property contains no data.
The difference in my code, I added a schema:
Code:
Ext.define('ProgramsMyApp.model.ProgramSchema', {
extend: 'Ext.data.schema.Schema',
alias: 'schema.programschema'
});
Ext.define('ProgramsMyApp.model.ProgramModel', {
extend: 'Ext.data.Model',
requires: [
'ProgramsMyApp.model.ProgramSchema',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json',
'Ext.data.field.Date'
],
schema: 'programschema',
fields: [
{
name: 'id'
},
{
name: 'name'
}
],
proxy: {
type: 'ajax',
url: 'j/mprx.php',
actionMethods: {
create: 'POST',
read: 'POST',
update: 'POST',
destroy: 'POST'
},
reader: {
type: 'json',
rootProperty: 'r'
}
}
});
Ext.define('ProgramsMyApp.model.Attachment', {
extend: 'Ext.data.Model',
requires: [
'ProgramsMyApp.model.ProgramSchema',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json',
'Ext.data.field.Date'
],
uses: [
'Programs508T.model.ProgramModel'
],
schema: 'programschema',
fields: [
{
name: 'id'
},
{
name: 'name'
},
{
name: 'programId',
reference: 'ProgramsMyApp.model.ProgramModel'
}
],
proxy: {
type: 'ajax',
url: 'j/mprxPA.php',
actionMethods: {
create: 'POST',
read: 'POST',
update: 'POST',
destroy: 'POST'
},
reader: {
type: 'json',
rootProperty: 'r'
}
}
});
On the 'detail' form for a program, I have a button and in the click event am trying to get the related list of records so I can open a new view/grid and pass them to it:
Code:
var detailView = button.up('form');
var form = detailView.getForm();
var record = form.getRecord();
var records = record.programMyAppModelProgramAttachments(); //am seeing nothing in the data[] property/object here
// once I have records would open a new grid and pass them to it here