locked
Change Site Column order RRS feed

  • Question

  • Hi, I have some Site Columns, Content Type and a List Definition. To change the order of the fields is it enough to change the order inside the list schema.xml file or I have to do anything else?
    Monday, May 13, 2013 9:56 AM

Answers

  • Yes it is possible with schema.xml as you see in the below snapshot , I changed the order of the fields in the below newform.aspx with the help of schema <viewfields>.

    <ViewFields>
              <FieldRef Name="Type1"></FieldRef>
              <FieldRef Name="Type2"></FieldRef>
              <FieldRef Name="Title"></FieldRef>
            </ViewFields>


    Thanks


    Tuesday, May 14, 2013 4:28 PM

All replies

  • you can use powershell to do this.

    refer http://sharepointempower.com/2013/03/column-ordering-in-sharepoint-2010/


    http://www.sharepointlovers.com

    Monday, May 13, 2013 1:36 PM
  • Hi Jayaraja, I have to do this in the solution. So what I want to know is if the order in the Schema and inside the Content Type is enough to provide the order change. thanks
    • Edited by renatois Monday, May 13, 2013 4:08 PM
    Monday, May 13, 2013 3:45 PM
  • Changing the order in schema.xml is enough. order of fields in <ViewFields> is responsible for column order

        <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
            <Toolbar Type="Standard" />
            <XslLink Default="TRUE">main.xsl</XslLink>
            <RowLimit Paged="TRUE">30</RowLimit>
            <ViewFields>     
            <FieldRef Name="Type1" /><FieldRef Name="Type2" /><FieldRef Name="Title" /></ViewFields>
            <Query>
              <OrderBy>            
              <FieldRef Name="ID"></FieldRef></OrderBy>
            </Query>
            <ParameterBindings>
              <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
              <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
            </ParameterBindings>
          </View>


    Thanks

    Monday, May 13, 2013 4:13 PM
  • Hi Senthilekn, the OrderBy is not the best way for me because I just had to create a new field and I want to place it in the second place. So there is no OrderBy that will fit my needs, the best way would be to manually write the fields one after the other without considering the OrderBy, something like the example below, is it possible? thanks

            <ViewFields>
              <FieldRef Name="LinkTitle"></FieldRef>
              <FieldRef Name="Soustitre"></FieldRef>
              <FieldRef Name="Description"></FieldRef>
              <FieldRef Name="Image"></FieldRef>
            </ViewFields>
    

    Monday, May 13, 2013 4:41 PM
  • May be I have to reword my sentence in my last reply. I meant order of field in the <viewField> tag not the orderby tag

    For your question, It is possible and it is the exact way to acheive it


    Thanks


    Monday, May 13, 2013 5:13 PM
  • Hi Senthilekn, the order that I want to change is how the fields are displayed in the newform list, and not there values. So I want the user to fill the Title, then the Subtitle, then the description, then the Image... So maybe I am not in the right way...

    thanks

    • Edited by renatois Tuesday, May 14, 2013 8:36 AM
    Tuesday, May 14, 2013 8:31 AM
  • Yes it is possible with schema.xml as you see in the below snapshot , I changed the order of the fields in the below newform.aspx with the help of schema <viewfields>.

    <ViewFields>
              <FieldRef Name="Type1"></FieldRef>
              <FieldRef Name="Type2"></FieldRef>
              <FieldRef Name="Title"></FieldRef>
            </ViewFields>


    Thanks


    Tuesday, May 14, 2013 4:28 PM