From 8d82d04a318e81dfb761abd4cf4c99974c37471b Mon Sep 17 00:00:00 2001 From: kurund Date: Fri, 24 Jan 2014 14:58:12 -0800 Subject: [PATCH] default value fixes --- js/view/crm.designer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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){ -- 2.25.1