I have code that opens a selection list based on a relationship, the code looks like this
find_customers: function () {
var self = this;
var model = self.model;
var linkModelRelName = 'accounts_in_customers_1';
var contactBean = app.data.createBean('Contacts', {id: this.model.get('id')});
var related_collection = contactBean.getRelatedCollection('accounts_contacts_1');
related_collection.fetch(
{
relate: true,
success: _.bind(function (attributeData) {
var account = attributeData.models;
var accountID = account[0].get('id');
//var accountBean = app.data.createBean('Accounts', {id: accountID});
var pt = app.data.createBeanCollection('IN_Customers');
pt.setOption('endpoint', function (method, collection, options, callbacks) {
var endPoint = 'Accounts/' + accountID + '/link/accounts_in_customers_1';
var url = app.api.buildURL(endPoint);
return app.api.call('get', url, null, callbacks);
});
app.drawer.open(
{
layout: 'selection-list',
context: {
module: 'IN_Customers',
parent: 'Accounts',
model: self.createLinkModel(model, linkModelRelName),
collection: pt,
}
}, _.bind(self.recordSelected, {
model: model
}));
})
});
},
There are 4 records that should be shown but I only ever get 2 back.
If I click on more records, it changes the count to 2 or 37043 but adds none to the screen. I have checked all tables and other places this relationship is exposed and I always get 4 records. It is just with thsi code that it returns the wrong number.