tags:

views:

1036

answers:

1

Edited heavily - Original question below.

I have a custom list (installed from a feature) that is basically a calendar. The default month, week, and day views take advantage of a custom web part that injects javascript into the page for the purpose of adding background colors.

Users who wish to add a Personal View can do so, however the new personal views will not have the custom coloring web part on the page by default. The user can select "Personalize this Page" from the welcome menu and add the web part, but upon clicking "Exit Edit Mode" the web part disappears.

Why is this happening and how do I make it work?


I have a custom web part that injects some script tags onto the page. This web part is intended to be used on custom Calendar list to give some background colors to events of various Categories (a custom field). This works great on Shared Views, not at all on Personal Views.

If I create a Personal View and base it off of the default Calendar.aspx view, and then select "Edit this page" from the Site Actions menu, the calendar disappears. If I add the custom web part to the page and select "Modify this web part" I get the "A web part you attempted to change is either invalid or has been removed by another user."

Is it possible to add web parts to personal views? Is there a better way to achieve this custom background coloring?

UPDATE: The url of a personal view is something like this: .../Lists/CalendarName/PersonalViews.aspx?ShowWebPart={GUID}. If I remove the querystring then no calendar displays, but if I inspect the page contents the web part is actually rendering content! It does not render if the ShowWebPart={GUID} is present. Using the debugger, I see that it does not load at all as far as i can tell.

UPDATE 2: More weirdness. If I customize this page by selecting "Personalize this page" from the welcome menu, it lets me add my custom web part, and it looks great, but only until I click "Exit Edit Mode" and my custom web part disappears again.

+1  A: 

Create your view, make it personal.

Personalize the page, adding your web part.

Then exit edit mode. In the query string, delete the &ShowWebPart=GUID part. Your personal web part should show up.

Personal views each have a GUID. The selector in a list view uses the querystring to show which view to display, hence the ShowWebPart parameter. I don't believe there is any way to override the behavior in the list selector to not use that ShowWebPart parameter, without great effort.

Nathan DeWitt
Chloraphil
put a link on the nav bar on the left to the page without the GUID in the querystring. Permanency FTW.
Nathan DeWitt
that's not very handy for users
Chloraphil
also, what about a user who creates more than 1 personal view?
Chloraphil
showing all the views they create on the same page is no good, huh?
Nathan DeWitt
to what page are you referring?
Chloraphil
navigating to PersonalViews.aspx?PageView=Personal appears to always show the most recently created personal view.
Chloraphil
It actually displays *all* the views created. Create two views, navigate to that page, then scroll down.
Nathan DeWitt