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

A web part which shows a list is supposed to display only one view of the list

Asked By Asif Rehmani
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

Ok, I understand why it is a good thing to predefine a view.

Asked By TomVervoor
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 !

Hi Tom,The reason that you see the difference in behavior between a

Asked By mark.parson
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
change view in webpart
Asked By TomVervoor
01-Mar-07 01:21 AM
Your answer is all I needed to know... thanks !
Ability to change Views in a SharePoint List displayed on a Page
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  :)
Post Question To EggHeadCafe