Domanda

Trying below code to read Site column but getting value as [object Object] OnClick Function:

onClick={()=>{this.Funnel(items.SiteColumn)}}

Complete function code:

              public render(): React.ReactElement<IAutomationProps> 
              {
                return (
                  <div style={divStyle} >
                    {this.state.items.map((items,key)=>

            {
              return(
                  <DocumentCard
                    aria-label={items.RatingCount} styles={cardStyles} 
                   
                    onClick={()=>{this.Funnel(items.SiteColumn)}}
                  >.
                    <DocumentCardImage height={150} imageFit={ImageFit.cover} imageSrc={items.Picture? items.Picture["Url"] : ''} />
                    <DocumentCardDetails>
                      <DocumentCardTitle title={items.Title} shouldTruncate />
                       <label >{items.RatingCount}</label>
                    </DocumentCardDetails>
                  </DocumentCard> );
                  
                  })}
                </div>
                );
È stato utile?

Soluzione

Multiple selection choice column will be returned in following JSON format while using SharePoint REST API:

"Product_x0020_Catalogue": {
    "__metadata": {
        "type": "Collection(Edm.String)"
    },
    "results": [
        "Enter Choice #1",
        "Enter Choice #2"
    ]
}

So you need to use items.Product_x0020_Catalogue.results to get the array of multiple selected choice values.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top