none
添加Ribbon按钮到新组的问题 RRS feed

  • 问题

  • 定义如下,结果是定义的组显示出来了。但是组中的按钮却没有显示出来。谢谢

    <RibbonDiffXml>
     <CustomActions>
      <CustomAction Id="test.test_perentity.form.approve" Location="Mscrm.Form.test_perentity.MainTab.Groups._children" Sequence="1000">
       <CommandUIDefinition>
        <Group Id="test.test_perentity.form.approve.group" Sequence="1001"
            Title="$LocLabels:test.test_perentity.form.approve.group.loclabel"
            Template="Mscrm.Templates.Flexible2">
         <Controls Id="test.test_perentity.form.approve.group.controls">
          <Button Id="test.test_perentity.form.approve.button.submit"
              Image32by32="$webresource/test/2.png"
              Command="test.test_perentity.form.approve.button.submit.command"
              TemplateAlias="o1"
              Sequence="1002"
              LabelText="$LocLabels:test.test_perentity.form.approve.button.submit.loclabel" />
          <Button Id="test.test_perentity.form.approve.button.approve"
              Image32by32="$webresource/test/2.png"
              Command="test.test_perentity.form.approve.button.approve.command"
              TemplateAlias="o1"
              Sequence="1003"
              LabelText="$LocLabels:test.test_perentity.form.approve.button.approve.loclabel" />
    
         </Controls>
        </Group>
    
       </CommandUIDefinition>
      </CustomAction>
     </CustomActions>
     <Templates>
      <RibbonTemplates Id="Mscrm.Templates">
      </RibbonTemplates>
    
     </Templates>
     <CommandDefinitions>
      <CommandDefinition Id="test.test_perentity.form.approve.button.approve.command">
       <EnableRules>
        <EnableRule Id="test.test_perentity.WebClient.EnableRule"></EnableRule>
        <EnableRule Id="test.test_perentity.form.NotNew.EnableRule"></EnableRule>
       </EnableRules>
       <DisplayRules>
        <DisplayRule Id="test.test_perentity.WebClient.DisplayRule" />
        <DisplayRule Id="test.test_perentity.form.FormStateNotNew.DisplayRule" />
       </DisplayRules>
       <Actions>
        <JavaScriptFunction Library="$webresource:test_sample_ShowMessage.js" FunctionName="show" >
         <StringParameter Value="A" />
        </JavaScriptFunction>
       </Actions>
      </CommandDefinition>
      <CommandDefinition Id="test.test_perentity.form.approve.button.submit.command">
       <EnableRules>
        <EnableRule Id="test.test_perentity.WebClient.EnableRule"></EnableRule>
       </EnableRules>
       <DisplayRules>
        <DisplayRule Id="test.test_perentity.WebClient.DisplayRule" />
       </DisplayRules>
       <Actions>
        <JavaScriptFunction Library="$webresource:test_sample_ShowMessage.js" FunctionName="show">
         <StringParameter Value="A" />
        </JavaScriptFunction>
       </Actions>
      </CommandDefinition>
     </CommandDefinitions>
     <RuleDefinitions>
      <TabDisplayRules />
      <DisplayRules>
       <DisplayRule Id="test.test_perentity.form.FormStateNotNew.DisplayRule">
        <FormStateRule State="Create"
            InvertResult="true" />
       </DisplayRule>
       <DisplayRule Id="test.test_perentity.WebClient.DisplayRule">
        <CrmClientTypeRule Type="Web"/>
       </DisplayRule>
      </DisplayRules>
      <EnableRules>
       <EnableRule Id="test.test_perentity.WebClient.EnableRule">
        <CrmClientTypeRule Type="Web" />
       </EnableRule>
       <EnableRule Id="test.test_perentity.form.NotNew.EnableRule">
        <FormStateRule State="Create"
            InvertResult="true" />
       </EnableRule>
      </EnableRules>
     </RuleDefinitions>
     <LocLabels>
      <LocLabel Id="test.test_perentity.form.approve.button.submit.loclabel">
       <Titles>
        <Title languagecode="2052" description="提交" />
       </Titles>
      </LocLabel>
      <LocLabel Id="test.test_perentity.form.approve.button.approve.loclabel">
       <Titles>
        <Title languagecode="2052" description="审批" />
       </Titles>
      </LocLabel>
      <LocLabel Id="test.test_perentity.form.approve.group.loclabel">
       <Titles>
        <Title languagecode="2052" description="审批" />
       </Titles>
      </LocLabel>
     </LocLabels>
    </RibbonDiffXml>
    


     

    2011年8月31日 2:20

答案

  • 你需要在CustomActions节点下,添加CustomAction节点,以指定Size与scale

    例如

    <CustomAction Id="test.test_perentity.form.approve.customaction.maxsize" Location="Mscrm.Form.test_perentity.MainTab.Scaling._children" Sequence="80">
    <CommandUIDefinition>
    <MaxSize Id="test.test_perentity.form.approve.customaction.maxsize" Sequence="80" Size="LargeLarge" GroupId="test.test_perentity.form.approve.group" />
    </CommandUIDefinition>
    </CustomAction>
    <CustomAction Id="test.test_perentity.form.approve.customaction.scale" Location="Mscrm.Form.test_perentity.MainTab.Scaling._children" Sequence="190">
    <CommandUIDefinition>
    <Scale Id="test.test_perentity.form.approve.customaction.scale" Sequence="190" Size="LargeSmall" GroupId="test.test_perentity.form.approve.group" />
    </CommandUIDefinition>
    </CustomAction>
    </CustomActions>


    daemon lin
    • 已标记为答案 Dirk2011 2011年8月31日 4:21
    2011年8月31日 3:29

全部回复

  • 你需要在CustomActions节点下,添加CustomAction节点,以指定Size与scale

    例如

    <CustomAction Id="test.test_perentity.form.approve.customaction.maxsize" Location="Mscrm.Form.test_perentity.MainTab.Scaling._children" Sequence="80">
    <CommandUIDefinition>
    <MaxSize Id="test.test_perentity.form.approve.customaction.maxsize" Sequence="80" Size="LargeLarge" GroupId="test.test_perentity.form.approve.group" />
    </CommandUIDefinition>
    </CustomAction>
    <CustomAction Id="test.test_perentity.form.approve.customaction.scale" Location="Mscrm.Form.test_perentity.MainTab.Scaling._children" Sequence="190">
    <CommandUIDefinition>
    <Scale Id="test.test_perentity.form.approve.customaction.scale" Sequence="190" Size="LargeSmall" GroupId="test.test_perentity.form.approve.group" />
    </CommandUIDefinition>
    </CustomAction>
    </CustomActions>


    daemon lin
    • 已标记为答案 Dirk2011 2011年8月31日 4:21
    2011年8月31日 3:29
  • 使用的Sequence不能太大,还有就是CustomAction 与MaxSize Scale的Sequence要一致。

    2011年9月1日 5:23