SharePoint的列表进行2级以上的分组的方法.docx

上传人:b****8 文档编号:9441466 上传时间:2023-02-04 格式:DOCX 页数:12 大小:461.09KB
下载 相关 举报
SharePoint的列表进行2级以上的分组的方法.docx_第1页
第1页 / 共12页
SharePoint的列表进行2级以上的分组的方法.docx_第2页
第2页 / 共12页
SharePoint的列表进行2级以上的分组的方法.docx_第3页
第3页 / 共12页
SharePoint的列表进行2级以上的分组的方法.docx_第4页
第4页 / 共12页
SharePoint的列表进行2级以上的分组的方法.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

SharePoint的列表进行2级以上的分组的方法.docx

《SharePoint的列表进行2级以上的分组的方法.docx》由会员分享,可在线阅读,更多相关《SharePoint的列表进行2级以上的分组的方法.docx(12页珍藏版)》请在冰豆网上搜索。

SharePoint的列表进行2级以上的分组的方法.docx

SharePoint的列表进行2级以上的分组的方法

SharePoint:

GroupByonmorethan2columnsinaview(SP2010)

ThisisanupdateofanarticlewrittenforSharePoint2007.Manyofthestepsarethesameinboth2007and2010,butboththeSharePointDesignerstepsandthedefaultwebpartusedforviewshavechanged.

GroupByonmorethan2columnsinaview

InmySharePointclassesIhaveoftenbeenofaskedhowtogrouponmorethantwolevelsinaview.Ihavealwaysgiventhequickanswerof"useSharePointDesigner"!

But,someofyouhaveasked"How?

".Youmaybesorryyouasked…butheregoes…

Goals:

∙Createaviewwithnestedgroupsdeeperthanjust2levels

∙Putthecountsandtotalsatthebottomofeachsection.

∙Dotheabovewithnocustomwebparts,customXSLToranythingthathastobedeployedtotheserver.

Sample:

SecretsandTricksneeded:

∙Itcan'tbedone"outofthebox"inthebrowser

∙SharePointDesignerisneededtomaketheedits

∙YouneedtoconverttheviewwebparttoaSharePointDesignerDataFormWebPart

∙YouneedaSortandGroupsecret

∙Youneedtofixthefooterrows

∙Youneedtomanuallyaddyourtotals,averages,countsetc.

Warning!

SharePoint2010doesnotconsiderapagewithaDataFromWebParttobea“view”.Itonlybelievesthatapageisa“view”whenithasan“XsltListViewWebPart”.In2007wecouldcreateanewview,edititinSharePointDesignerasmuchaswewanted,anditwasstillaview.In2010,SharePointwillnotrecognizeapagewithoutaXsltListViewWebPartasaview.

Sobeforeyoustart…

∙Ifyoujustneedapagewithyourlistnicelygrouped,itmaybebestjusttocreateawebpartpageandstoreitinalibrary.ThenaddtheDataFormWebPartusingthestepsbelow.

∙Ifyouwantthepagetobetreatedasaview,leavetheXsltListViewWebPartonthepage,butmakeithidden.ThenaddtheDataFormWebPartbelowtheexistingwebusingthestepsbelow.

oInSP2010,aviewpagewithanaddedwebpartintroducesabugortwo.Theribbonwillnotbedisplayed.Theviewdropdowninthepagetitleareawillbemissingthedropdowntoselectanotherview.

MyExample:

∙Ihaveasimplelist(actuallyimportedfromExcel)withthesecolumns:

ID1,Bike,BikeType,BikeSize,BikeColorandRetail(price).

∙IwanttogroupthisonBikeType,BikeSize,BikeColorandcounttheitemsandsumoraveragethepriceineachgroup.

CreateanewStandardViewfromthelist'sviewmenu.

Don'tbotherwithanyoptionsaswearejustgoingtodeletethedefaultlistwebpart.

Orjustcreateanemptywebpartpage.(see“Warning”above)

The“before”–justastandardviewwithselectedcolumns:

Ifusinganexistingviewpage:

∙OpenyoursitewithSharePointDesignerandclicktheListsandLibrariesnodeintheSiteObjectspane

∙Clickyourlist(“Bikes”inmyexample)

∙Clickyourviewyoucreatedearlier(“Grouped”inmyexample)

Otherwisecreateanewwebpartpageinalibrary

∙Notes(backgroundonly,youcanskipthis):

oTheviewisnowbeingdisplayedusingaXsltListViewWebPart(ItwasaListViewWebPartinSP2007)andcanonlybecustomizedwiththesameoptionsasfoundusingabrowser("ModifyView")

oTheXsltListViewWebParthasthesamegroupinglimitationsandtheListViewWebPart(2levelsofgrouping)

oFormoreinfoonwhathaschangedfromthe2007ListViewWebPartandtheXsltListViewWebPartseeand

oSharePointDesigner2010hastwowebpartsforlists:

▪XsltListViewWebPart-thisisthewebpartusedwhenyoucreateanewView

▪DataFormWebPart–createdfromSharePointDesignerusingInsert,EmptyDataView

oSPD2010addsabitofconfusionwhentryingtoadda“DataView”

▪WhenyouclickInsert,(pickanexistinglist)SPDinsertsanXsltListViewWebPart

▪WhenyouclickInsert,EmptyDataViewSPDinsertsaDataFormWebPart

∙Ifstartingwithanexistingview,deleteorhidetheexistingwebpart.

oDelete:

IntheDesignwindowclickinthewebpart,clicktheWebPartPages:

XsltListViewWebParttab,presstheDeletekey

or

intheCodewindowselecttheentire

XsltListViewWebParttag(includingthestartandendtags)anddeletethecode

oHide:

IntheDesignwindowclickinthewebpart.IntheRibbonintheListViewToolssectionclicktheWebParttabandthenclickProperties.IntheLayoutssectionofpropertiesclickHidden

∙InsertanEmptyDataViewWebpart

oClicktheInsertRibbontabandclicktheDataViewbutton

oClickEmptyDataView

oInthenewwebpartclick“Clickheretoselectadatasource”

oClickyourlistandclickOK(thiswillopentheDataSourceDetailsPane)

oSelectthecolumnsyouwantinyourlist(clickafield,thenShift-clickeachadditionalfield)

oClickthe“InsertSelectedFieldsas”buttonandclick“MultipleItemView”

Note:

IfyoufollowedtheearlierarticleforSharePoint2007,therestofthestepsareprettymuchthesame.

Note:

theviewisnowbeingdisplayedusingaDataFormWebPartand:

∙isnolongera“View”andcannotlongerbemodifiedfromthebrowser

∙canbecustomizedfromSharePointDesigner,

∙fromthebrowseryoucanonlyrenametheview,

∙fromthebrowseryoucanalsouseSiteActions,EditPage,ModifySharedWebParttohandedittheXSLT,;-)

∙goingforward,columnsaddedtothelistwillnotbeautomaticallyaddedtotheDataFormWebPart.YouwillneedtouseSharePointDesignertomanuallyaddthecolumnstothe“view’.

Save!

AtthispointyoumaywanttoclickSaveandreviewtheresultssofarinabrowser.Reviewtheformattingandnotethethingsyouneedtochange.

∙EdittheDataViewWebPart

∙ClickthewebpartandnotethatyounowhaveDataViewToolssectionintheSharePointDesignerribbon.

∙Click“SortandGroup”

∙RemoveanysortfieldsthatmayalreadybeintheSortOrdercolumn

Addyourtopmostgroup:

oClickthefield(BikeType)and

oClickAdd

oClick“Showgroupheader”

oClick“Collapsegroupbydefault”(optional)

oClick“Showgroupfooter”(ifyouwantcountsandtotals)

Addyoursecondgroupbyclickingthefield(Example:

Size)andclickingAdd.

∙Ifyoustophereyouwillhavegroups,butallofyourcountsandtotalswillbewrong!

Weneedtocreateboththetexttodisplayforthegroupandahierarchyforthegrouping.Atthesecondlevelofourgroupingweneedtogrouponthecombinationofbothcolumns,“BikeType”plus“Size”

∙Click“EditSortExpression”

oAtaminimumyouwillneedtoconcatenatethecurrentgroupingcolumnwiththepreviousgroupingcolumns,andwhileyouareatityoucanaddsome“pretty”formatting:

oEnter:

concat(@Bike_x0020_Type,"-",@Size)(Watchthecapitalization!

UsetheexactnametheIntelisenseoffers–spacesare“coded”so“BikeType”is“Bike_x0020_Type”.)

oNotethepreviewatthebottomofthedialogbox…

oClickOK

oClickShowgroupheader

oClickCollapsegroup(optional)

oClickShowgroupfooter(ifyouwantcountsandtotals)

∙ Forthethirdandfollowinggroups-repeatthestepabovewithSortExpressionssimilarto:

∙concat(@Bike_x0020_Type,"-",@Size,"-",@Bike_x0020_Color)

∙Morecolumns?

Ineachnewgroupincludeallofthefieldsfromthepreviousgroupsalongwithanyseparatorsyoulike:

concat(@group1field,@group2field,@group3field,@group4field,@group5field,etc)

orconcat(@group1field,"-",@group2field,"-",@group3field,"-",@group4field,"-",@group5field,etc)

∙Ifyoucouldseethefullwidthoftheseyouwouldsee:

∙ BeforeclickingOKtoleavethisdialogbox,checktheorderofthegroups.Theyhaveprobablygottenchanged.(bug?

∙Makesuretheyareinordersomethinglike:

@BikeType

concat(@Bike_x0020_Type,"-",@Size)

concat(@Bike_x0020_Type,"-",@Size,"-",@Bike_x0020_Color)

∙Recheckeachofthesortlevelstoseeifthesearestillchecked:

oClickShowgroupheader

oClickCollapsegroup(optional)

oClickShowgroupfooter(ifyouwantcountsandtotals)

∙ Optionallyaddonemorecolumnjusttosortthedatawithinthelastgroup.Donotturnonthegroupheaderorgroupfooteroptionsforthissort-onlyfield.

∙ ClickOKtoclosetheSortandGroupdialogbox.

∙ YouwillprobablywanttochangethePagingoptionsastheydefaultto10items.ClickthePagingbuttonintheRibbon(DataViewToolsgroup,Optiontab)

∙ Tip:

IfyouhavealotofdatainthelistSharePointDesignercangetreallyslow.Therearetwothingsyoucoulddohere,setpagingtoasmallnumber(notsogoodfortestingmulti-levelgrouping)orfromtheCommonControlTasksselectShowWithSampleData.

∙ IfyouwantgrandtotalsyouwillalsoneedtoclickDataViewPropertiesandcheckShowViewFooter.

∙ Save!

AtthispointyoumaywanttoclickSaveandreviewtheresultssofarinabrowser.Youshouldnowhaveallofyourgroups.

Clickthe+toexpandasection.

∙ Nowisagoodtimetocleanuptheformattingsuchasthegraybackgroundandoddrowheightinthegroupheaderandfooterrows.(Right-clickintherowinDesignviewandselectCellProperties.

(clickforbiggerview)

∙ Yourgroupingworkisnowdone.Thefollowingstepsareonlyneededifyouwanttoaddtotals,counts,averages,etc.

∙ Nowfortotals!

∙Thesestepsdescribeaddingtotalstothefooterrows,butalsoapplytomodifyingheader(topofeachgroup)rows.

∙TheDataViewsetsuptheheaderandfooterrowsasasinglecellwithacolumnspanof99!

Todisplaytotalsinthesamecolumnsandthedatayouwillneedtofixtheserows.

∙Youwillneedtofixeachofthegroupfooterrowsplustheviewfooterrow.

∙ Inthe

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1