We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamically set Captions from Json Data

Thread ID:

Created:

Updated:

Platform:

Replies:

148362 Oct 16,2019 12:06 PM UTC Oct 17,2019 01:09 PM UTC React - EJ 2 1
loading
Tags: PivotView
spirit
Asked On October 17, 2019 12:59 PM UTC

Hi Syncfusion Team ,

Please How do i set the captions in FieldList dynamically  .Most examples already show presets of the caption. .

Thanks

Sivamathi Natarajan [Syncfusion]
Replied On October 17, 2019 01:09 PM UTC

  
 
Thanks for contacting Syncfusion Support. 
  
You can set caption to any field even it is not bound in report. It can be achieved by using enginePopulated event. Please refer the following code snippet. 
  
 
Code Snippet:[React] 
export class GroupingBarSample extends SampleBase { 
  onenginePopulated(args) { 
    if (isInitial) { 
      isInitial = false; 
      Object.keys(this.pivotObj.engineModule.fieldList).forEach((key, index) => { 
        if (key === 'Quarter') { 
          this.pivotObj.engineModule.fieldList[key].caption = 'Qtr'; 
        } 
      }); 
    } 
  } 
 
  render() { 
    return (<div className='control-pane'> 
      <div className='col-lg-9 control-section' id='pivot-table-section' style={{ overflow: 'initial' }}> 
        <PivotViewComponent id='PivotView' ref={(scope) => { this.pivotObj = scope; }} dataSourceSettings={dataSourceSettings} width={'100%'} height={'450'} showGroupingBar={true} showFieldList={true} gridSettings={{ columnWidth: 140 }} enginePopulated={this.onenginePopulated.bind(this)}> 
          <Inject services={[GroupingBar, FieldList]} /> 
        </PivotViewComponent> 
      </div> 
    </div>); 
  } 
} 
  
  
Meanwhile, we prepared a sample for your reference. 
  
Please let us know, if you need further assistance on this. 
  
Regards, 
Sivamathi Natarajan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon