0

複数のボタンを持つ静的 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>
4

2 に答える 2

0

私が気づいたいくつかのマイナーなこと。両方のボタンのシーケンス番号は同じです。最初のボタンを10に変更します。次に、2番目のボタンのコマンドdefにMscrm.Enabledルールがありません。

これらのリボンは気難しいのが大好きです。

于 2011-05-20T16:19:42.370 に答える
0

あなたがしていることは問題ないように見えるので、webresource 名とすべてを再確認してください。

トラブルシューティングへのアプローチ 1) 機能する Web リソース/関数にすべてを切り替えます 2) JavaScript Web リソースに他の関数を追加し、それがまだ機能するかどうかを確認します (失敗した場合、それは JavaScript 関数でした)。3) websresource をすべて同じに保ちながら、FunctionName の 1 つを 2 番目の関数に切り替えます。

于 2011-05-17T16:41:03.210 に答える