(function($, _) { var ufGroupCollection = new CRM.UF.UFGroupCollection(_.sortBy(CRM.initialProfileList.values, 'title')); //var ufGroupCollection = new CRM.UF.UFGroupCollection(CRM.initialProfileList.values, { // comparator: 'title' // no point, this doesn't work with subcollections //}); ufGroupCollection.unshift(new CRM.UF.UFGroupModel({ id: '', title: ts('- select -') })); /** * Example: * * ... * cj('.crm-profile-selector').crmProfileSelector({ * groupTypeFilter: "Contact,Individual,Activity;;ActivityType:7", * entities: "contact_1:IndividualModel,activity_1:ActivityModel" * }); * * Note: The system does not currently support dynamic entities -- it only supports * a couple of entities named "contact_1" and "activity_1". See also * CRM.UF.guessEntityName(). */ $.fn.crmProfileSelector = function(options) { return this.each(function() { // Hide the existing