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

When i am trying to get data from rich text box from list and bind it to pnp Rich text box nothing is visible in control, though the data is there in that state i have assigned, i have checked in developer tool.....but it is not showing #588

Closed
sunnysinha05 opened this issue Jun 16, 2020 · 8 comments
Labels
Needs: Author Feedback no-recent-activity status:tracked Triaged and are being investigated further

Comments

@sunnysinha05
Copy link

import * as React from 'react';
import styles from './RichTextTest.module.scss';
import { IRichTextTestProps } from './IRichTextTestProps';
import { escape } from '@microsoft/sp-lodash-subset';

import { sp } from "@pnp/sp";
import { RichText } from "@pnp/spfx-controls-react/lib/RichText";
import { autobind } from 'office-ui-fabric-react/lib/Utilities';
import "@pnp/sp/webs";
import "@pnp/sp/lists";
import "@pnp/sp/items";

export interface ISpfxPnpRichtextState {
description: string;
SuccessMessage: string;
}

export default class RichTextTest extends React.Component<IRichTextTestProps, ISpfxPnpRichtextState,{}> {
constructor(props: IRichTextTestProps, state: ISpfxPnpRichtextState) {
super(props);
sp.setup({
spfxContext: this.props.context
});

this.state = { SuccessMessage: '', description: '' };
this._getDescription();
}
public render(): React.ReactElement {
return (
< RichText isEditMode={true} value={this.state.description} />
);
}

@autoBind
private async _getDescription() {
const item: any = await sp.web.lists.getByTitle("Employee Registration").items.getById(61).get();

console.log(this.state.description);
console.log(item.Description);

let dummyElement = document.createElement("DIV");
dummyElement.innerHTML = item.Description;
let outputText = dummyElement.innerText;

this.setState({ description: outputText });
}

@autoBind
private async _updateDescription() {
console.log(this.state.description);
const updatedItem = await sp.web.lists.getByTitle("Employee Registration").items.getById(61).update(
{
Description: this.state.description
});
this.setState({ SuccessMessage: 'Successfully saved' });
}
}

@ghost
Copy link

ghost commented Jun 16, 2020

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

@ghost ghost added the Needs: Triage 🔍 label Jun 16, 2020
@sunnysinha05
Copy link
Author

i am getting the data but not binding/showing...please suggest...

@estruyf estruyf added status:tracked Triaged and are being investigated further and removed Needs: Triage 🔍 labels Jun 17, 2020
@estruyf
Copy link
Member

estruyf commented Jun 17, 2020

Thanks @sunnysinha05 for reporting this. We will do our best to find the issue and solve it.

@sunnysinha05
Copy link
Author

Hi Team,
Any updates on this ?

@sunnysinha05
Copy link
Author

Guys can you help please.

@AJIXuMuK
Copy link
Collaborator

Hi @sunnysinha05,

Is it still an issue? I've tried to repro, but it's working correctly.

Here is a brief test:

public render(): React.ReactElement<IRichTextTestProps> {
    return (
      <div className={ styles.richTextTest }>
        <RichText isEditMode={true} value={this.state.description} />
        <PrimaryButton text={'Change description'} onClick={() => {
          this.setState({
            description: `description: ${Math.random()}`
          });
        }} />
      </div>
    );
  }

@ghost
Copy link

ghost commented Feb 5, 2021

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

@ghost ghost closed this as completed Feb 12, 2021
@ghost
Copy link

ghost commented Feb 12, 2021

Closing issue due no response from original author. If this issue is still occurring, please open a new issue with additional details. Notice that if you have included another related issue as additional comment on this, please open that also as separate issue, so that we can track it independently.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback no-recent-activity status:tracked Triaged and are being investigated further
Projects
None yet
Development

No branches or pull requests

3 participants