+ doSetPaletteEntity: function(event) {
+ this.selectedContactType = $('.crm-contact-types :selected').val();
+ // loop through entity collection and remove non-valid entity section's
+ var newUfEntityModels = [];
+ this.model.getRel('ufEntityCollection').each(function(oldUfEntityModel){
+ var values = oldUfEntityModel.toJSON();
+ if (values.entity_name == 'contact_1') {
+ values.entity_type = $('.crm-contact-types :selected').val();
+ }
+ newUfEntityModels.push(new CRM.UF.UFEntityModel(values));
+ });
+ this.model.getRel('ufEntityCollection').reset(newUfEntityModels);
+ },