how to avoid default values while adding new record in react grid in batch edit mode

when we creating columns dynamically, in a column object we tried giving default value as empty (colmnObj.defaultValue = '';). but still default values are generating while adding a record.

1 Reply 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team February 15, 2021 07:38 AM UTC

Hi bhojaraj, 
 
Greetings from Syncfusion support. 
 
You can achieve your requirement by using beforeBatchAdd event of the Grid. Please refer the below code example and sample for more information. 
 
    beforeBatchAdd (args) { 
      // here you can change the default value for each column 
      args.defaultData.OrderID = 100; 
    } 
    render() { 
        return (<div className='control-pane'> 
        <div className='control-section'> 
          <div className='col-md-9'> 
              <GridComponent dataSource={data} pageSettings={this.pageSettings} beforeBatchAdd={this.beforeBatchAdd.bind(this)}  > 
                 . . . 
                <Inject services={[PageToolbarEdit]}/> 
              </GridComponent> 
            </div> 
 
        </div> 
      </div>); 
    } 
} 
 
 
 
 
 
 
Please let us know, if you need further assistance. 
 
Regards, 
Manivel 


Marked as answer
Loader.
Up arrow icon