For developers, A inconvenient function of a data view is that a data view developed or customized cannot be reused at all. You cannot export data to a page or website as if you were using Web components. However, there is a Web component that we can use for various customization. This is the Web Content Query component.
Http://msdn.microsoft.com/zh-cn/library/ms497457 (En-US). aspx
How to: Query content Web Display custom fields in the widget
Content QueryWebPartsDisplays dynamic views. ThisWebParts can run cross-site and list queries on the same website in a centralized manner, and then the query results are displayed on the page. For example, you can useWebParts to display the latest of a website including all storage locations5ItemsArticle.
ThisWebThere are two main parts:QueryAndPresentation.QueryDetermines what you want to display,PresentationDetermines the style you use to display the content. You can also apply rules to determine whether a specific type can beWebThe widget is displayed.
In the tool panel, you can make the following settings:
Select the query range. You can configureWebA widget is used to query a website or a specific list of the entire website set or website set.
Select the type of the queried list.
Specifies the type of the displayed content.
Select additional filtering to control the display content. For example, a filter is set to display all the article pages of the author.
Select the sorting and grouping options to determine the order of project display.
Select style options to controlWebHow to display the project and group headers of a widget.
By defaultXSLThe following four fields of the style sheet rendering query result items: title, description, and imageURLAndURLLink bar (if any ). ThisWebParts will separate the imageURLAndURLThe hyperlink bar is rendered as an image and hyperlink.
If you want to query and render the columns specified by the custom content type, you need. WebpartMake some small changes in the file to make the defaultXSLTo support custom columns.
This section explains howWebThe part query includes the above-mentioned custom columns. How can I tellWebThe parts automatically rename the above columns as the defaultXSLTSupported columns; use the defaultXSLTConvert the style to render these columns.
To better understand these steps, let's give an example. For example, if you haveKnowledge Base Article (Knowledge Base articles)Content type, which includes the following columns:
Knowledge Base title(Text)
Product(Text)
Version(Text)
Status(Option)
You associate this content type in a document library, which is calledKnowledge Base Article. You want to query the content on the homepageWebThis content type is queried and displayed in the widget.Knowledge Base titleAndProductTo do this, you must complete the following steps:
Display custom Fields
1.Add a"Content QueryWebParts".
In"Query"In this section, set the query source to query from the specific list of "Knowledge Base articles. Set the list type and content type in sequence.
In"Presentations"Section, set the style of the project,"Title and description".
2.EditWebComponent file to display custom properties. To modifyWebPart file, first inWebPart"Edit"Click"Export"To export. WebpartFile.
Moss 2007Generate. WebpartFile, which contains the completeWebA set of component attributes. This file isXMLFile, so you can edit it in the task text editor.
3.In this. WebpartFile, findCommonviewfieldsAttribute to specify the additional fields you want to display. Use the following format to add columns and types.
kb_x0020_title, text; product, text; |
note: |
you should use an internal name instead of your column name. You can right-click this column and select "attribute". Then, in the "Address" column of the browser, you can find the "field =" string, the internal name of this column is located at the end. In this example, the internal names of "Knowledge Base Article Title" and "product" are: kb_x0020_title and product . |
4.Map these internal columns to the defaultXSLTThe title and description in the conversion. Edit this stepDatacolumnrenamesAttribute.
<Property name = "datacolumnrenames" type = "string"> kb_x0020_title, title; product, description </property> |
Note: |
DefaultXSLTThe conversion can render the following four fields: title, description,URLHyperlinks, ImagesURL. In yourDatacolumnrenamesAttribute, confirm that you have specifiedXSLTConversion Name:Title, description, linkurl, imageurl. |
5.Save this. WebpartFile.
6.InWebPage, remove your1Query the added contentWebParts.
7.Import5To save the file, click "page" and "addWeb"Import" under "parts ". Specify. WebpartFile, and click upload ".
8.Put thisWebDrag parts to the appropriate area of the page. NowWebWidget displayKnowledge Base titleAndProductColumn.
If you wantStatusAndVersionIt is also displayed inKnowledge Base titleAndProductLater, you can modifyXSLTConvert and add rendering to the appended column.
Note:: |
The preceding example shows how to edit a singleWebTo include custom fields. However, you can also useSpd2007To modifyWebParts.SPD 2007YesWebA great tool for components, especially when used in the page layout, allWebAll components automatically apply the modified features. You can also add a customWebPartsWebIn the component library, you can drag and drop a new page to a certain area. |