深入浅出SharePoint——自定义带ECB列

第一步:使用SPM2007来查看默认的list中的title列的定义。

View Code
<Field ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" ReadOnly="TRUE" Type="Computed" Name="LinkTitleNoMenu" DisplayName="Title" Dir="" DisplayNameSrcField="Title" AuthoringInfo="(linked to item)" EnableLookup="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitleNoMenu" FromBaseType="TRUE">
      <FieldRefs>
        <FieldRef Name="Title" />
        <FieldRef Name="LinkFilenameNoMenu" />
      </FieldRefs>
      <DisplayPattern>
        <IfEqual>
          <Expr1>
            <LookupColumn Name="FSObjType" />
          </Expr1>
          <Expr2>1</Expr2>
          <Then>
            <Field Name="LinkFilenameNoMenu" />
          </Then>
          <Else>
            <HTML><![CDATA[<a onfocus="OnLink(this)" href="]]></HTML>
            <URL />
            <HTML><![CDATA[" ONCLICK="GoToLink(this);return false;" target="_self">]]></HTML>
            <Column HTMLEncode="TRUE" Name="Title" Default="(no title)" />
            <IfEqual>
              <Expr1>
                <GetVar Name="ShowAccessibleIcon" />
              </Expr1>
              <Expr2>1</Expr2>
              <Then>
                <HTML><![CDATA[<img src="/_layouts/images/blank.gif" class="ms-hidden" border=0 width=1 height=1 alt="]]></HTML>
                <HTML>Use SHIFT+ENTER to open the menu (new window).</HTML>
                <HTML><![CDATA[">]]></HTML>
              </Then>
            </IfEqual>
            <HTML><![CDATA[</a>]]></HTML>
            <IfNew>
              <HTML><![CDATA[<IMG SRC="/_layouts/1033/images/new.gif" alt="]]></HTML>
              <HTML>New</HTML>
              <HTML><![CDATA[">]]></HTML>
            </IfNew>
          </Else>
        </IfEqual>
      </DisplayPattern>
    </Field>
    <Field ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" ReadOnly="TRUE" Type="Computed" Name="LinkTitle" DisplayName="Title" DisplayNameSrcField="Title" ClassInfo="Menu" AuthoringInfo="(linked to item with edit menu)" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitle" FromBaseType="TRUE">
      <FieldRefs>
        <FieldRef Name="Title" />
        <FieldRef Name="LinkTitleNoMenu" />
        <FieldRef Name="_EditMenuTableStart" />
        <FieldRef Name="_EditMenuTableEnd" />
      </FieldRefs>
      <DisplayPattern>
        <FieldSwitch>
          <Expr>
            <GetVar Name="FreeForm" />
          </Expr>
          <Case Value="TRUE">
            <Field Name="LinkTitleNoMenu" />
          </Case>
          <Default>
            <Field Name="_EditMenuTableStart" />
            <SetVar Name="ShowAccessibleIcon" Value="1" />
            <Field Name="LinkTitleNoMenu" />
            <SetVar Name="ShowAccessibleIcon" Value="0" />
            <Field Name="_EditMenuTableEnd" />
          </Default>
        </FieldSwitch>
      </DisplayPattern>
    </Field>

第二步:分别填写两个新的Field ID,name,display name,DisplayNameSrcField,static name。

 

 术语:

ECB:EditControlButton

posted @ 2012-12-11 14:21  风影极光  阅读(326)  评论(0编辑  收藏  举报