Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with webpart deployment to display form #891

Closed
milleraa opened this issue Sep 22, 2016 · 4 comments
Closed

Problem with webpart deployment to display form #891

milleraa opened this issue Sep 22, 2016 · 4 comments

Comments

@milleraa
Copy link

milleraa commented Sep 22, 2016

Here is the model :

var webModel = SPMeta2Model
                            .NewWebModel(web =>
                            {
                                web
                                    .AddList(Lists.TestList1, list =>
                                    {
                                        list
                                            .AddHideContentTypeLinks(new HideContentTypeLinksDefinition
                                            {
                                                ContentTypes = { new ContentTypeLinkValue() { ContentTypeName = "Item" }, new ContentTypeLinkValue() { ContentTypeName = "Элемент" } }
                                            })
                                            .AddContentTypeLink(ContentTypes.MyType1)
                                            .AddListView(Views.View1)
                                            .AddHostListView(BuiltInListViewDefinitions.Lists.DispForm, view =>
                                            {
                                                view.AddWebPart(WebParts.TestWebPart3);
                                            });
                                    })
                                    .AddList(Lists.TestList2, list =>
                                    {
                                        list
                                            .AddHideContentTypeLinks(new HideContentTypeLinksDefinition
                                            {
                                                ContentTypes = { new ContentTypeLinkValue() { ContentTypeName = "Item" }, new ContentTypeLinkValue() { ContentTypeName = "Элемент" } }
                                            })
                                            .AddContentTypeLink(ContentTypes.MyType2)
                                            .AddListView(Views.View2)
                                            .AddHostListView(BuiltInListViewDefinitions.Lists.AllItems, view =>
                                             {
                                                 view.AddWebPart(WebParts.TestWebPart1);
                                             });
                                    })
                                    .AddList(Lists.TestList3, list =>
                                    {
                                        list
                                            .AddHideContentTypeLinks(new HideContentTypeLinksDefinition
                                            {
                                                ContentTypes = { new ContentTypeLinkValue() { ContentTypeName = "Item" }, new ContentTypeLinkValue() { ContentTypeName = "Элемент" } }
                                            })
                                            .AddContentTypeLink(ContentTypes.MyType3)
                                            .AddListView(Views.View3)
                                            .AddHostListView(BuiltInListViewDefinitions.Lists.DispForm, view =>
                                            {
                                                view.AddWebPart(WebParts.TestWebPart2);
                                            });
                                    });


                            });

Expected result:

  1. DispForm in List1 contains WebPart3
  2. AllItems.aspx in List2 contains WebPart1
  3. DispForm in List3 contains WebPart2

Actual result:

  1. DispForm in List1 contains WebPart2 and WebPart3
  2. Allitems.aspx in List2 contains WebPart1
    3 DispForm in List3 contains nothing but standart ListFormWebPart.
@SubPointSupport SubPointSupport added this to the 1.2.90 release milestone Sep 22, 2016
@SubPointSupport SubPointSupport self-assigned this Sep 22, 2016
@milleraa
Copy link
Author

PS C:\Users\spfa> $f.BuildVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
15     0      4841   1000

@SubPointSupport
Copy link
Contributor

Confirming the issue. Investigating.

@SubPointSupport
Copy link
Contributor

Fixed, running tests on list views regression and will push to dev. Will be in the 1.2.90 release on Monday.

Seems that if you have a XsltListViewWebPart on list forms-pages.
The result targetList.Views collection would have ALL list views + your binded view from the web part. Here is an output from the debug:

//  targetList.RootFolder.Url   "Lists/TestList3"   string
//  targetList.Views[0].ServerRelativeUrl   "/Lists/TestList3/AllItems.aspx"    string
//  targetList.Views[1].ServerRelativeUrl   "/Lists/TestList1/DispForm.aspx"    string
//  targetList.Views[2].ServerRelativeUrl   "/Lists/TestList3/AllItems3.aspx"   string

Seems to be a pure SharePoint API issue. We added additional filtering so that the target page / file is found right. The result on your model looks good, exactly as expected.

@milleraa
Copy link
Author

Great! I'll wait for Monday.

SubPointSupport added a commit that referenced this issue Sep 24, 2016
+ added tests for Problem with webpart deployment to display form #891
@SubPointSupport SubPointSupport modified the milestones: 1.2.90 release, 2016.10.03, 1.2.90 Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants