From: kurund Date: Fri, 24 Jan 2014 22:58:12 +0000 (-0800) Subject: default value fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8d82d04a318e81dfb761abd4cf4c99974c37471b;p=civicrm-core.git default value fixes --- diff --git a/js/view/crm.designer.js b/js/view/crm.designer.js index dccef6abda..26b93d076d 100644 --- a/js/view/crm.designer.js +++ b/js/view/crm.designer.js @@ -325,9 +325,13 @@ paletteView.model.getRel('ufEntityCollection').each(function(ufEntityModel){ _.each(ufEntityModel.getSections(), function(section, sectionKey){ + var defaultValue = paletteView.selectedContactType; + if (!defaultValue) { + defaultValue = paletteView.model.getUFGroupModel(); + } // set selected option as default, since we are rebuilding palette - paletteView.$('.crm-contact-types').val(ufEntityModel.attributes.entity_type).prop('selected','selected'); + paletteView.$('.crm-contact-types').val(defaultValue).prop('selected','selected'); var entitySection = ufEntityModel.get('entity_name') + '-' + sectionKey; var items = []; @@ -403,6 +407,7 @@ $('.crm-designer-palette-tree').jstree("search", $(event.target).val()); }, 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){