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

How to use OnRenderRow property of ListView control? Can you please provide an example? #1785

Closed
SharePointReady opened this issue Feb 29, 2024 · 5 comments

Comments

@SharePointReady
Copy link

SharePointReady commented Feb 29, 2024

Category

[ ] Enhancement

[ ] Bug

[X] Question

Version

Please specify what version of the library you are using: [ 3.17.0 ]

Expected / Desired Behavior / Question

How to implement the function for OnRenderRow propery of the ListView control?
The example given at the documentation for DetailsList control is not working for ListView control.

Thanks!

@ghost
Copy link

ghost commented Feb 29, 2024

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Feb 29, 2024
Copy link

Thank you for submitting your first issue to this project.

@patrikhellgren
Copy link
Contributor

Since Fluent UI DetailsList is used under the hood, there are lots of samples available online but you could have a look at the official Fluent UI DetailsList documentation, e.g. DetailsList - Custom item rows.
Nothing special otherwise in @pnp/spfx-controls-react.

@SharePointReady
Copy link
Author

Hi Patrik,

Thanks for reply. The example given at the DetailsList - Custom item rows is not working for ListView control. It gives below error.

image

@SharePointReady
Copy link
Author

Hi I figured it out as Patrick said. please see below example.

`private _onRenderRow = (props: any) => {

    // console.log('Row Props: ', props);
    
    const customStyles: Partial<IDetailsRowStyles> = {};
    customStyles.root = { backgroundColor: '#ffe680' };

    return props.item.isEmailResponse ? <DetailsRow {...props} styles={customStyles} /> : <DetailsRow {...props} />;
};`

Thanks,
Jemi

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