Skip to content

Instantly share code, notes, and snippets.

@shijinkrishna
Last active December 24, 2015 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shijinkrishna/c5b79492254bdf37bce3 to your computer and use it in GitHub Desktop.
Save shijinkrishna/c5b79492254bdf37bce3 to your computer and use it in GitHub Desktop.
({
extendsFrom: 'RelateField',
initialize: function(options) {
this._super('initialize', [options]);
},
openSelectDrawer: function() {
var filterOptions = new app.utils.FilterOptions()
.config({
'initial_filter': 'FilterCoursesTemplate',
'initial_filter_label': 'LBL_FILTER_COURSES_TEMPLATE',
'filter_populate': {
'accounts_courses_accounts_ida': this.model.get('accounts_enrollments_accounts_ida'),
}
})
.format();
//this custom code will effect for all relate fields in Enrollment module.But we need initial filter only for Courses relate field.
filterOptions = (this.getSearchModule() == "Courses") ? filterOptions : this.getFilterOptions();
app.drawer.open({
layout: 'selection-list',
context: {
module: this.getSearchModule(),
fields: this.getSearchFields(),
filterOptions: filterOptions,
}
}, _.bind(this.setValue, this));
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment