AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.03.2011, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Microsoft Dynamics CRM Team Blog: Create Dynamic Ribbon Controls
Источник: http://blogs.msdn.com/b/crm/archive/...-controls.aspx
==============

Microsoft Dynamics CRM 2011 uses Ribbons (also known as Fluent UI) to provide a user interface to display the right commands at the right time. Ribbons also provide a very powerful and flexible way of extending the ribbon functionality to meet your requirements. If you are new to ribbon customization in Microsoft Dynamics CRM 2011, see the SDK documentation: Customize the Ribbon for Microsoft Dynamics CRM.

I’m going to show you how to create dynamic Ribbon controls. You will typically use dynamic controls so that your ribbon elements can react to changes in data or context. ComboBox, DropDown, FlyoutAnchor, MRUSplitButton and SplitButtoncontrols can contain other collections of controls. These controls can be created with static definitions at design time or they can be populated dynamically using a JavaScriptFunction that uses a Script Web Resource.

In this article I will demonstrate how to dynamically create ribbon Button elements and populate them inside a FlyoutAnchor. The end result will look like this:



The procedure uses these steps:

  1. Define the Parent Control
  2. Define CommandDefinitions
  3. Create a Script Web Resource
Define the Parent Control

Once you determine the location where you would like to create a dynamic menu, create a CustomAction to add the CommandUIDefinition as shown below.



Important:

For both CommandDefinition elements, you must use the CrmParameter with the Value attribute set to "CommandProperties". This object will be used later in the script web resources to read which dynamically generated button is selected and to set the dynamically generated ribbon xml.

Create a Script Web Resource

Create a Script Web resource named new_dynamicmenupopulator.js. Set the contents of this JScript library to the following code:

<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:7e54dcd0-6a37-4be0-bd60-b36a96a22e18" class="wlWriterSmartContent">function DynamicMenu(CommandProperties) { var menuXml =''; CommandProperties.PopulationXML = menuXml; } function Search(CommandProperties) { var controlId = CommandProperties.SourceControlId; switch (controlId) { case'ISV.Dynamic.Button1': alert('Button 1 Command Implementation'); break; case'ISV.Dynamic.Button2': alert('Button 2 Command Implementation'); break; default: alert('Button Unknown'); } }
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
Microsoft Dynamics CRM Team Blog: Building a Self-Contained Virtual CRM Development Server Blog bot Dynamics CRM: Blogs 0 05.05.2009 10:05
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05
Microsoft Dynamics CRM Team Blog: Rolling out CRM: Who should take ownership? Blog bot Dynamics CRM: Blogs 0 25.11.2008 02:08
Microsoft Dynamics CRM Team Blog: Highlight: Available downloads for Microsoft Dynamics CRM Blog bot Dynamics CRM: Blogs 0 05.11.2008 22:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 07:37.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.