我创建了一个带有多个按钮的静态 FlyOut 控件。单击这些按钮时,应该触发不同的 JS。我为每个 JS 函数创建了 Commanddefinition,并在按钮控件中引用了它们。但是,我的按钮被禁用了。如果所有按钮都引用相同的 commanddefinition/js 函数,则可以正常工作。我错过了什么?任何帮助将不胜感激。这是我的代码:
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="Add_Dynamic_Menu"
Location="Mscrm.Form.new_test.MainTab.Workflow.Controls._children">
<CommandUIDefinition>
<FlyoutAnchor Id="Sample.new_test.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.new_test.form.Menu">
<MenuSection Id="Sample.new_test.form.MenuSection"
Title="Menu Section Title" Sequence="15">
<Controls Id="Sample.new_test.form.MenuSection.Controls">
<Button Id="Sample.new_test.form.Controls.Button.FirstButton"
Command="Sample.FirstButtonComand" LabelText="First Button"
ToolTipTitle="First Button"
ToolTipDescription="The first button" TemplateAlias="isv"
Sequence="20"/>
<Button Id="Sample.new_test.form.Controls.Button.SecondButton"
Command="Sample.SecondButtonCommand" LabelText="Second Button"
ToolTipTitle="Second Button"
ToolTipDescription="The Second button" TemplateAlias="isv"
Sequence="20"/>
</Controls>
</MenuSection>
</Menu>
</FlyoutAnchor>
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"/>
</Templates>
<CommandDefinitions>
<CommandDefinition Id="Sample.FirstButtonCommand">
<EnableRules>
<EnableRule Id="Mscrm.Enabled"/>
</EnableRules>
<DisplayRules/>
<Actions>
<JavaScriptFunction FunctionName="testfirstbutton"
Library="$webresource:new_testfirstbutton"> </JavaScriptFunction>
</Actions>
</CommandDefinition>
<CommandDefinition Id="Sample.SecondButtonCommand">
<EnableRules/>
<DisplayRules/>
<Actions>
<JavaScriptFunction FunctionName="testsecondbutton"
Library="$webresource:new_testsecondbutton"> </JavaScriptFunction>
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules/>
<DisplayRules/>
<EnableRules/>
</RuleDefinitions>
<LocLabels/>
</RibbonDiffXml>