首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PNP CustomCollectionFieldType - PeoplePicker找不到用户

PNP CustomCollectionFieldType - PeoplePicker找不到用户
EN

Stack Overflow用户
提问于 2022-09-28 11:29:50
回答 1查看 84关注 0票数 0

正如标题所述,我试图在我的PropertyFieldCollectionData属性窗格中使用SPFx。但是当我运行代码并试图在人中搜索时,什么也没有出现,甚至连我自己也没有。

不知道这是否有帮助,但这也是进口品

代码语言:javascript
复制
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
  IPropertyPaneConfiguration,
  IPropertyPaneDropdownOption,
  PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart, WebPartContext } from '@microsoft/sp-webpart-base';
import * as strings from 'FaqProjectWebPartStrings';
import FaqProject from './components/FaqProject';
import { IFaqProjectProps } from './components/FaqProject';
import { PropertyFieldListPicker, PropertyFieldListPickerOrderBy } from '@pnp/spfx-property-controls/lib/PropertyFieldListPicker';
import { IPropertyFieldGroupOrPerson, PropertyFieldDropdownWithCallout, PropertyFieldPeoplePicker } from '@pnp/spfx-property-controls';
import { CalloutTriggers } from '@pnp/spfx-property-controls/lib/PropertyFieldHeader';
import { PropertyFieldToggleWithCallout } from '@pnp/spfx-property-controls/lib/PropertyFieldToggleWithCallout';
import { PropertyFieldCollectionData, CustomCollectionFieldType } from '@pnp/spfx-property-controls/lib/PropertyFieldCollectionData';   
import { PeoplePicker, PrincipalType } from '@pnp/spfx-controls-react/lib/PeoplePicker';

我的FaqProjectWebPart.ts中的示例代码

代码语言:javascript
复制
                PropertyFieldCollectionData("collectionData", {
                  key: "collectionData",
                  label: "Collection data",
                  panelHeader: "Collection data panel header",
                  manageBtnLabel: "Manage collection data",
                  value: this.properties.collectionData,
                  fields: [
                    {
                      id: "Title",
                      title: "Name",
                      type: CustomCollectionFieldType.string,
                      required: true
                    },
                    {
                      id: "Group",
                      title: "Choose a group",
                      type: CustomCollectionFieldType.custom,
                      onCustomRender: (field, value, onUpdate, item, itemId, onError) => {
                        return (
                          React.createElement(PeoplePicker, {
                            context: this.context as any ,
                            personSelectionLimit: 1,
                            showtooltip: true,
                            key: itemId,
                            defaultSelectedUsers: [item.customFieldId],
                            onChange: (items: any[]) => {
                              console.log("Items", items);
                              item.customFieldId = items[0].secondaryText;
                              onUpdate(field.id, items[0].secondaryText);
                            },
                            showHiddenInUI: false,
                            principalTypes: [PrincipalType.User]
                          })
                        )
                      },
                    },
                  ],
                  disabled: false
                }),

道具

代码语言:javascript
复制
export interface IFaqProjectWebPartProps {
  description: string;
  faqListId: string;
  categoryListId: string;
  subCategoryListId: string;
  panelViewToggle: boolean;
  people: IPropertyFieldGroupOrPerson[];
  collectionData: any[];  
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-29 10:31:27

在库(在3.11中修复)的3.10版本中似乎有一个错误导致了这种行为。为了解决这个问题,可以回滚到3.9

https://github.com/pnp/sp-dev-fx-controls-react/issues/1292

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73880650

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档