Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save betobaz/d1874afe7cab8acc1a62 to your computer and use it in GitHub Desktop.
Save betobaz/d1874afe7cab8acc1a62 to your computer and use it in GitHub Desktop.
SugarCRM:Sidecar: Change Edit list max per page in subpanel any module
({
extendsFrom: 'SubpanelListView',
initialize: function(options) {
// `dataViewName` corresponds to the list of fields the API should retrieve.
this.dataViewName = options.name || 'subpanel-list';
this._super("initialize", [options]);
var limit = this.context.get('limit') || app.config.maxSubpanelResult;
// Setup max limit on collection's fetch options for this subpanel's context
if(this.context.get('module') === 'Cases'){
debugger;
limit = 2;
}
if (limit) {
this.context.set('limit', limit);
//supanel-list extends indirectly ListView, and `limit` determines # records displayed
this.limit = limit;
// FIXME SC-3670 needs to remove this `collectionOptions` mess.
var collectionOptions = this.context.has('collectionOptions') ? this.context.get('collectionOptions') : {};
this.context.set('collectionOptions', _.extend(collectionOptions, {limit: limit}));
}
//Override the recordlist row template
this.rowTemplate = app.template.getView('recordlist.row');
this.layout.on("hide", this.toggleList, this);
// Listens to parent of subpanel layout (subpanels)
this.listenTo(this.layout.layout, 'filter:change', this.renderOnFilterChanged);
this.listenTo(this.layout, 'filter:record:linked', this.renderOnFilterChanged);
//event register for preventing actions
//when user escapes the page without confirming deletion
app.routing.before("route", this.beforeRouteUnlink, this, true);
$(window).on("beforeunload.unlink" + this.cid, _.bind(this.warnUnlinkOnRefresh, this));
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment