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. Image for the cookie policy date

Dynamically set Captions from Json Data

Hi Syncfusion Team ,

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


1 Reply

SN Sivamathi Natarajan Syncfusion Team 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]} /> 
Meanwhile, we prepared a sample for your reference. 
Please let us know, if you need further assistance on this. 
Sivamathi Natarajan 

Live Chat Icon For mobile
Up arrow icon