Code Monkey home page Code Monkey logo

Comments (9)

estruyf avatar estruyf commented on July 25, 2024 1

@trillian74 can this issue be closed?

from sp-dev-fx-controls-react.

estruyf avatar estruyf commented on July 25, 2024

@AJIXuMuK is this something you can do?

@trillian74 what would you like to see being added to the documentation?

from sp-dev-fx-controls-react.

AJIXuMuK avatar AJIXuMuK commented on July 25, 2024

@estruyf, Yep, will be my pleasure.
@trillian74 please, let us know what additional information you'd like to see.

Currently we have few scenarios described on how to use Field Controls including FieldUserRenderer.

  • if you go to Getting started page for Field controls you'll see example on how to use FieldRendererHelper that will automatically detect needed type of Field control based on Field Type.
  • on FieldUserRenderer control page you can find the code that you can use to embed FieldUserRenderer into your Field Customizer.

Let us know if you need something more.

from sp-dev-fx-controls-react.

trillian74 avatar trillian74 commented on July 25, 2024

thanx
I'm wondering most upon the users={event.fieldValue} Normally i just have the siteuserid or login for the user i want to render. I see that it wants IPrincipal. I've tried building one, but no cigar on this control.

from sp-dev-fx-controls-react.

trillian74 avatar trillian74 commented on July 25, 2024

Let say how do i complete this within a listviewfields
private viewFields: Array<IViewField> = [ { name: "Id", displayName: "Id" }, { name: "AuthorId", displayName: "Author", render: ((d: any) => { sp.web.getUserById(d.AuthorId).get().then((user) => {....

i want to render out author as a user control with card?

from sp-dev-fx-controls-react.

AJIXuMuK avatar AJIXuMuK commented on July 25, 2024

@trillian74 what is the scenario where you're trying to use the control?
Basically, Field Controls are implemented to be used in FieldCustomizer extension where you actually have this event.fieldValue in onRenderCell handler.
But it looks like you have some custom "list view" control or something.

The IPrincipal interface looks like that:

/**
 * Represents a principal value as it is stored in People and Groups field
 */
export interface IPrincipal {
    id: string;
    email: string;
    department: string;
    jobTitle: string;
    sip: string;
    title: string;
    value: string;
    picture: string;
}

And it actually represents how the User or Group Field's value is passed to the FieldCustomizer.

You can import it like that:

import { IPrincipal } from "@pnp/spfx-controls-react/lib/FieldCommon";

If you want to use it outside FieldCustomizer you should create the IPrincipal object by yourself and provide at least values for id, email and title.

from sp-dev-fx-controls-react.

trillian74 avatar trillian74 commented on July 25, 2024

I have this ListView control (in a webpart) that has sp user column, which of course only have Ids like AuthorId etc.... In the ListView i want to render the column using the FieldUserRenderer control.

Is this possible using the ListView and Array with override render?

from sp-dev-fx-controls-react.

AJIXuMuK avatar AJIXuMuK commented on July 25, 2024

@trillian74
I didn't play around with ListView control and its render override.
From FieldUserRenderer point of you - yes, you can do that if you provide the IPrincipal info as I described above.

from sp-dev-fx-controls-react.

trillian74 avatar trillian74 commented on July 25, 2024

Thanx

from sp-dev-fx-controls-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.