SharePoint - change view in webpart

Asked By TomVervoor
28-Feb-07 09:57 AM
When you go to a document library or list in Sharepoint 2007, you see a
dropdown in which you can select a different view or create a new view if you
have the right permissions.

If you go to a page and put a list view webpart on it to show that same
document library or list, you can make it look almost exactly the same as the
document library or list itself, except for the dropdown to select a view.

Why is it not possible to select a view from this webpart ? Are there some
technical issues with this ? Or can it be enabled somewhere ?

Best regards,

Tom
  Asif Rehmani replied...
28-Feb-07 04:50 PM
A web part which shows a list is supposed to display only one view of the
list at a time.  You can definitely change the view by modifying the shared
web part properties.

So the question comes to mind: "Why would I want to display only one view of
a list?".  Well, consider this scenario:

You have a list which displays Job Postings within the company.  In that
list, you have defined "Begin date" and "Expiration date" columns.  Now
let's say you create 3 views on that list and call them "Current Job
Postings", "Previous Job Postings" and "Upcoming Job Postings".  You use the
Begin date and Expiration date column to define which records to show for
each view.  Now you can deploy 3 web parts on your site and each of the web
parts would be displaying the Job Postings list with a different view
exposed.

Hope that made sense.  Let me know if you need further clarification.

--
_______________________________
Asif Rehmani, MCT
Trainer / Solution Architect
SharePoint Solutions | Chicago Office
asif@sharepointsolutions.com.(no-spam)
SharePoint Training: http://www.sharepointsolutions.com/chicago
SharePoint 2007 Videos: http://www.sharepoint-screencasts.com
SharePoint Blog: http://sharepoint-screencasts.com/blog
  TomVervoor replied...
28-Feb-07 05:07 PM
Ok, I understand why it is a good thing to predefine a view. But here's what
I don't get:

If you create a list, the default view is 'All items'. If you open up
'allitems.aspx' in the SharePoint Designer, you see that it is actually just
a ListViewWebpart with the ability to change the view.

If you display the list on another page, it is also a ListViewWebpart, but
you don't have the option to change the view anymore. At least... the
end-user can't change this anymore.

Still, it is twice the same webpart !
  mark.parson replied...
28-Feb-07 06:03 PM
Hi Tom,

The reason that you see the difference in behavior between a ListViewWebPart
in the AllItems.aspx page vs. a ListViewWebPart that you add to a web page is
because there are web part properties such as the ListViewXML property that
are set differently.

The ListViewXML property contains CAML that defines the view.  When you
create a custom list or library, SharePoint generates a list view web part
for you, named after your custom list.  It also automatically sets the
ListViewXML property for the web part with CAML that describes how to display
your list as you see it when you add the part to a page.  This automatic
configuration does not include the drop down and other nice features that the
web part on the AllItems.aspx includes.  The list view web part on the
AllItems.aspx page contains CAML that includes the features such as the drop
down list with different views.

SharePoint gives you no user interface to manipulate this CAML besides that
you can do by modifying a view, which is not much.  You can directly edit the
ListViewXML from the tag properties panel,  but to do anything sophisticated
using this technique would be extremely difficult.

You might try copying the ListViewWebPart definition from the AllItems.aspx
page to your new ListViewWebPart.

You could also convert I would suggest that you convert the ListViewWebPart
on the AllItems.aspx page to a DataView and copy that.  This is what I would
do, since all of the CAML gets converted to XSLT which can be manually
changed to do whatever you like.

Hope this helps - mark

--
_______________________________
Mark Parsons | Cofounder, Architect
Distributed Logic Corp.
mark.parsons@distributedlogic.com Team Blog:
http://www.sharepointplatform.com/teamblog
  TomVervoor replied...
01-Mar-07 01:21 AM
Your answer is all I needed to know... thanks !
  Shari Lawler replied to mark.parson
22-Apr-10 10:40 AM
Thanks so much for making this conversation available to others.  If I only have access to WSS (not MOSS or Designer), is it possible to do as you've described and create a page that displays list contents and allows users to change views?  I'm unable to locate a widget to maniuplate and copy AllItems.aspx as described  :)
help
project con sharepoint SharePoint SharePoint Portal Server Dev Discussions Sharepoint (1) Laurent (1) Cotton (1) Conectarme (1) Intentar (1) Liliana (1) Error (1) Project (1 Laurent Cotton www.bewise.fr es un error que sale al intentar conectarme con el sharepoint keywords: project, con, sharepoint description: !- - Web.Config configuration File- - configuration system.web customErrors mode = On deafaultRedirect = mycustompage.htm system
access into sharepoint SharePoint Sharepoint is new to my organisation and we are on the verge of deploying it to and import those? How have others resolved this issue? Your help is most appreciated, Matt SharePoint Discussions SharePoint (1) InfoPath (1) WSS 3.0 and MOSS 2007 (you didn't say which SharePoint product *and version* you were asking about) allow you with Access 2007 to synchronize (in both directions) Access tables and SharePoint Lists. It probably works in both directions (with some restrictions on field types used) although and then open that file using the template you created in InfoPath. keywords: access, into, sharepoint description: Sharepoint is new to my organisation and we are on the verge of deploying
Office SharePoint, Windows SharePoint and SharePoint Portal SharePoint Hi, I am a novice about SharePoint. Can anybody tell me if Office SharePoint, Windows SharePoint and SharePoint Portal are same thing? same server application? or what is the different among them? Thanks
Using a Windows Application to publish Office files to SharePoint SharePoint SharePoint 2.0, Office 2003, VS 2K5 In creating an automated document management Windows application, I need to be able to programmatically save (publish) various documents (.doc, .xls, .pdf, .tiff) to SharePoint, but I don't know which assembly to use. I tried system.io, but that on the URI class and WebRequests, but I just don't get it. Thanks, Ross SharePoint Development Discussions SPDocumentLibrary (1) SPListItem (1) SPList (1) SPSite (1) SPWeb (1) SharePoint (1) Lists.UpdateListItmes (1) Office 2003 (1) If you are using the windows application on a box that has access to the SharePoint server and SharePoint dll's, I would use the Microsoft.SharePoint namespace. If you used that namespace, you
wiki sharepoint SharePoint Hi Does someone know if there are any good wiki webparts available for sharepoint SharePoint Discussions Sharepoint (1) Webparts (1) SharePoint v3 (MOSS 2007 and WSSv3) includes Wiki functionality. Engelbert Have you heard about the Wiki to this work. Ben Aloha derksj, For 2003 I don't know of any, but SharePoint 2007 has a Wiki template included out of the box. -Ben- Ben M. Schorr - MVP http: / / www.rolandschorr.com Microsoft OneNote FAQ: http: / / www.factplace.com / onenotefaq.htm keywords: wiki, sharepoint description: Hi Does someone know if there are any good wiki webparts available for sharepoint