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

Grid multi-select, initialize with multiple selected

I'm trying to use the enableSimpleMultiRowSelection of the GridComponent, and want to select rows initially for my component when it renders. 

There is a selectedRowIndex which only selects 1 row according to the docs. How do I select multiple, do I have to use the underlying Javascript functionality with a databound callback?

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team May 13, 2019 09:39 AM UTC


Greetings from Syncfusion support. 

Based on your query we suspect that you want to select multiple record in Grid when load the Grid initially. So, we suggest you to use the below code example to achieve your requirement. 


import { render } from 'react-dom'; 
import './index.css'; 
import * as React from 'react'; 
import { GridComponent, Grid, ColumnsDirective, ColumnDirective, Toolbar, ColumnChooser, Inject, Page  } from '@syncfusion/ej2-react-grids'; 
import { data } from './data'; 
import { SampleBase } from './sample-base'; 
export class ColChooser extends SampleBase { 
      this.selectedRowIndices = [1,2,4]; 
    constructor() { 
        this.settings = { mode: 'Row', type: 'Multiple'}; 
    render() { 
        return (<div className='control-pane'> 
    <div className='control-section'> 
        <GridComponent dataSource={data} ref={grid => 
            this.gridInstance = grid} dataBound={this.dataBound.bind(this)}  allowPaging={true} selectionSettings={this.settings} > 
            <Inject services={[Page]} /> 

We have prepared a simple sample in the following stackblitz link. 

Refer the help documentation. 

Thavasianand S. 

Live Chat Icon For mobile
Up arrow icon