SharePoint development experience No. 2: List (Document Library) column width settings

Source: Internet
Author: User
Brief description of requirements:
When using the document library view to present content data, it is inevitable that a column is similar to long fields such as "details" and "Description", but it is not so satisfied that the style is automatically controlled, it is important to set the column width of a column in the document library or list library...

...............
Implementation routine:

First, let's take a look at the current library list without any settings: the column named "con" automatically adjusts the column width according to the width of the content (the "con" column is the newly created multiple line textbox ), however, it is always uncomfortable for viewers. next we will change its appearance style step by step.
First, let's take a look at the source code of the current page (it is best to use the webpage code editing tool. It is not recommended to directly edit this page with SharePoint designer because allitems is opened. aspx file, and here we mainly analyze the HTML code from response to the client, and then modify its style sheet)

The client code corresponding to con is marked as: <TH class = "ms-vh2-nograd" Scope = "col" nowrap = true>

Open the list library with SharePoint designer and go to the allitem. ASPX page to find the following code area:

<Asp: Content contentplaceholderid = "placeholdermain" runat = "server">
<Webpartpages: webpartzone runat = "server" frametype = "NONE" id = "Main" Title = "LOC: Main"> <zonetemplate>

Change

<Asp: Content contentplaceholderid = "placeholdermain" runat = "server">
<Style type = "text/CSS">
. Ms-vh2-nograd {
Width: 300px;
}
</Style>
<Webpartpages: webpartzone runat = "server" frametype = "NONE" id = "Main" Title = "LOC: Main"> <zonetemplate>

Save allitem. aspx and publish to view the effect:

Is it a significant improvement?

Analysis:
In fact, this demo is not a perfect solution, because now we control the ms-vh2-nograd class in the style sheet, If I create a multiple line textbox type field in this list, then it is clear that this column will also follow the style definition of the ms-vh2-nograd class ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.