我是 crm 2011 的新手。我找到了有关如何向功能区添加新按钮的文档。以及如何对按钮进行分组。但我需要功能区中的下拉菜单按钮。我怎样才能做到这一点?我没有找到任何关于此的信息。
谢谢!
最佳答案
这应该可以帮助您入门。如果您只需要一个静态菜单,您可以将标签放入 Flyout Control 并从那里构建菜单。
<FlyoutAnchor Id="Sample.account.form.FlyoutAnchor.Static"
Sequence="10"
Command="Mscrm.Enabled"
Image16by16="/_imgs/placeholders/ribbon_placeholder_16.png"
Image32by32="/_imgs/ribbon/newrecord32.png"
LabelText="Sample Flyout"
Alt="Sample Flyout"
TemplateAlias="isv">
<Menu Id="Sample.account.form.Menu">
<MenuSection Id="Sample.account.form.MenuSection"
Title="Menu Section Title"
Sequence="15">
<Controls Id="Sample.account.form.MenuSection.Controls">
<Button Id="Sample.account.form.Controls.Button.FirstButton"
Command="Sample.ButtonCommand.Command"
LabelText="First Button"
ToolTipTitle="First Button"
ToolTipDescription="The first button"
TemplateAlias="isv"
Sequence="20"/>
</Controls>
</MenuSection>
</Menu>
</FlyoutAnchor>
如果您想动态生成菜单,您可以改用这个弹出控件。请注意添加的 Populate 属性。 然后你必须通过 javascript 构建菜单。
<FlyoutAnchor Id="Sample.account.form.FlyoutAnchor.Dynamic"
Sequence="10"
Command="Mscrm.Enabled"
Image16by16="/_imgs/placeholders/ribbon_placeholder_16.png"
Image32by32="/_imgs/ribbon/newrecord32.png"
LabelText="Sample Flyout"
Alt="Sample Flyout"
PopulateDynamically="true"
PopulateQueryCommand="Sample.PopulateDynamicMenu"
TemplateAlias="isv" />
我创建了两个访问 javascript 函数的命令。 DynamicMenu 构建菜单,Search 用于确定按下了哪个按钮控件。请注意,这两个参数都传递了 CommandProperties 参数,这对 javascript 很重要。
<CommandDefinition Id="Sample.PopulateDynamicMenu">
<EnableRules>
<EnableRule Id="Mscrm.Enabled" />
</EnableRules>
<DisplayRules />
<Actions>
<JavaScriptFunction FunctionName="DynamicMenu"
Library="$webresource:a_JavaScript_File">
<CrmParameter Value="CommandProperties" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
<CommandDefinition Id="Sample.SearchCommand">
<EnableRules />
<DisplayRules />
<Actions>
<JavaScriptFunction FunctionName="Search"
Library="$webresource:a_JavaScript_File">
<CrmParameter Value="CommandProperties" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
这里是javascript函数:
function DynamicMenu(CommandProperties) {
///<summary>Dynamically generate menu items based on context</summary>
/// <param name="CommandProperties">
/// Command properties crm parameter sent from the ribbon. object used to inject the Menu XML
/// </param>
var menuXml = '<Menu Id="Sample.DynamicMenu">' +
'<MenuSection Id="Sample.Dynamic.MenuSection" Sequence="10">' +
'<Controls Id="Sample.Dynamic.Controls">' +
'<Button Id="Sample.account.form.Controls.Button.FirstButton"' +
' Command="Sample.SearchCommand"' +
' LabelText="First Button"' +
' ToolTipTitle="First Button"' +
' ToolTipDescription="The first button"' +
' TemplateAlias="isv"' +
' Sequence="20" />' +
'</Controls>' +
'</MenuSection>' +
'</Menu>';
CommandProperties.PopulationXML = menuXml;
}
function Search(CommandProperties) {
///<summary>Determines which control was pressed</summary>
/// <param name="CommandProperties">
/// Command properties crm parameter sent from the ribbon. object used to read which dynamically generated
/// button is selected.
/// </param>
var controlId = CommandProperties.SourceControlId;
switch (controlId) {
case 'Sample.account.form.Controls.Button.FirstButton':
alert(controlId + ' was pressed!');
break;
default:
alert('unknown');
}
}
关于xml - 将下拉菜单添加到 CRM 2011 功能区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5819080/
当我使用Bundler时,是否需要在我的Gemfile中将其列为依赖项?毕竟,我的代码中有些地方需要它。例如,当我进行Bundler设置时:require"bundler/setup" 最佳答案 没有。您可以尝试,但首先您必须用鞋带将自己抬离地面。 关于ruby-我需要将Bundler本身添加到Gemfile中吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4758609/
我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为
我有一个ModularSinatra应用程序,我正在尝试将Bootstrap添加到应用程序中。get'/bootstrap/application.css'doless:"bootstrap/bootstrap"end我在views/bootstrap中有所有less文件,包括bootstrap.less。我收到这个错误:Less::ParseErrorat/bootstrap/application.css'reset.less'wasn'tfound.Bootstrap.less的第一行是://CSSReset@import"reset.less";我尝试了所有不同的路径格式,但它
只是想确保我理解了事情。据我目前收集到的信息,Cucumber只是一个“包装器”,或者是一种通过将事物分类为功能和步骤来组织测试的好方法,其中实际的单元测试处于步骤阶段。它允许您根据事物的工作方式组织您的测试。对吗? 最佳答案 有点。它是一种组织测试的方式,但不仅如此。它的行为就像最初的Rails集成测试一样,但更易于使用。这里最大的好处是您的session在整个Scenario中保持透明。关于Cucumber的另一件事是您(应该)从使用您的代码的浏览器或客户端的角度进行测试。如果您愿意,您可以使用步骤来构建对象和设置状态,但通常您
当谈到运行时自省(introspection)和动态代码生成时,我认为ruby没有任何竞争对手,可能除了一些lisp方言。前几天,我正在做一些代码练习来探索ruby的动态功能,我开始想知道如何向现有对象添加方法。以下是我能想到的3种方法:obj=Object.new#addamethoddirectlydefobj.new_method...end#addamethodindirectlywiththesingletonclassclass这只是冰山一角,因为我还没有探索instance_eval、module_eval和define_method的各种组合。是否有在线/离线资
假设我有一个这样的单例类:classSettingsincludeSingletondeftimeout#lazy-loadtimeoutfromconfigfile,orwhateverendend现在,如果我想知道使用什么超时,我需要编写如下内容:Settings.instance.timeout但我宁愿将其缩短为Settings.timeout使这项工作有效的一个明显方法是将设置的实现修改为:classSettingsincludeSingletondefself.timeoutinstance.timeoutenddeftimeout#lazy-loadtimeoutfromc
对于用户模型,我有一个过滤器来检查用户的预订状态,该状态由整数值(0、1或2)表示。UserActiveAdmin索引页上的过滤器是通过以下代码实现的:filter:booking_status,as::select然而,这会导致下拉选项为0、1或2。当管理员用户从下拉列表中选择它们时,我更愿意自己将它们命名为“未完成”、“待定”和“已确认”之类的名称。有没有办法在不改变booking_status在模型中的表示方式的情况下做到这一点? 最佳答案 假设booking_status是模型中的枚举字段,您可以使用:过滤器:booking
是否可以为单个ActiveRecord实例添加回调?作为进一步的限制,这是继续使用库,所以我无法控制该类(除了对其进行猴子修补)。这或多或少是我想做的:defdo_something_creazymessage=Message.newmessage.on_save_call:do_even_more_crazy_stuffenddefdo_even_more_crazy_stuff(message)puts"Message#{message}hasbeensaved!Hallelujah!"end 最佳答案 你可以通过在创建对象后立
在Rails自动生成的功能测试(test/functional/products_controller_test.rb)中,我看到以下代码:classProductsControllerTest我的问题是:方法调用products()在哪里/如何定义?products(:one)到底是什么意思?看代码,大概意思是“创建一个产品”,但是它是如何工作的呢?注意我是Ruby/Rails的新手,如果这些是微不足道的问题,我深表歉意。 最佳答案 如果您查看test/fixtures文件夹,您会看到一个products.yml文件。这是在您创建
我确定这是一个相对简单的问题,并且必须有一个很好的明智的Rails方法来做这件事,但我不确定它是什么。基本上我是将书籍添加到数据库中,并且我想将作者存储在一个单独的表中。所以我有一个名为authors的表,由表books引用。我想创建一个用于添加书籍的Rails表单,我希望它只是作者、标题、出版商等的简单表单,如果它发现作者已经在作者表中,那么它应该只是引用该记录,如果它不在作者表中,那么它应该添加一个新记录并引用它。我确信在Rails中有一种简单的方法可以做到这一点-但我似乎找不到它。干杯,罗宾 最佳答案 假设您的表单传递auth